socketmpd.coffee -> coco

This commit is contained in:
Andrew Kelley 2012-10-06 04:12:45 -04:00
parent ca98326cb8
commit 27649f6838
2 changed files with 12 additions and 12 deletions

12
src/client/socketmpd.co Normal file
View file

@ -0,0 +1,12 @@
#depend "mpd" bare
window.SocketMpd = class SocketMpd extends window.Mpd
(@socket) ~>
super()
@socket.on 'FromMpd', ~> @receive(...)
@socket.on 'MpdConnect', ~> @handleConnectionStart(...)
@socket.on 'MpdDisconnect', ~> @resetServerState(...)
@socket.on 'disconnect', ~> @resetServerState(...)
send: !(msg) ->
@socket.emit 'ToMpd', msg

View file

@ -1,12 +0,0 @@
#depend "mpd" bare
window.SocketMpd = class SocketMpd extends window.Mpd
constructor: (@socket) ->
super()
@socket.on 'FromMpd', => @receive.apply(this, arguments)
@socket.on 'MpdConnect', => @handleConnectionStart.apply(this, arguments)
@socket.on 'MpdDisconnect', => @resetServerState.apply(this, arguments)
@socket.on 'disconnect', => @resetServerState.apply(this, arguments)
send: (msg) =>
@socket.emit 'ToMpd', msg