dial-a-device-node
Version:
dial-a-device-node is the device interface for dial-a-device
43 lines (34 loc) • 995 B
text/coffeescript
###
The Event object stores all the relevant event information.
###
class WebSocketRails.Event
constructor: (data, , ) ->
= data[0]
attr = data[1]
if attr?
= if attr['id']? then attr['id'] else (((1+Math.random())*0x10000)|0)
= if attr.channel? then attr.channel
= if attr.data? then attr.data else attr
= if attr.token? then attr.token
= data[2]
if attr.success?
= true
= attr.success
is_channel: ->
?
is_result: ->
typeof != 'undefined'
is_ping: ->
== 'websocket_rails.ping'
serialize: ->
JSON.stringify [, ]
attributes: ->
id: ,
channel: ,
data:
token:
run_callbacks: (, ) ->
if == true
?()
else
?()