electron/common/api/lib/callbacks-registry.coffee
Cheng Zhao bb69d99423 Use - as filename seperator for coffee script files. Fixes #15.
Also clean unused files and wrong file names.
2013-05-30 20:21:07 +08:00

21 lines
368 B
CoffeeScript

module.exports =
class CallbacksRegistry
constructor: ->
@nextId = 0
@callbacks = {}
add: (callback) ->
@callbacks[++@nextId] = callback
@nextId
get: (id) ->
@callbacks[id]
call: (id, args...) ->
@get(id).call global, args...
apply: (id, args...) ->
@get(id).apply global, args...
remove: (id) ->
delete @callbacks[id]