Move all sources under atom/.
This commit is contained in:
parent
26ddbbb0ee
commit
516d46444d
217 changed files with 519 additions and 519 deletions
25
atom/common/api/lib/callbacks-registry.coffee
Normal file
25
atom/common/api/lib/callbacks-registry.coffee
Normal file
|
@ -0,0 +1,25 @@
|
|||
module.exports =
|
||||
class CallbacksRegistry
|
||||
constructor: ->
|
||||
@emptyFunc = -> throw new Error "Browser trying to call a non-exist callback
|
||||
in renderer, this usually happens when renderer code forgot to release
|
||||
a callback installed on objects in browser when renderer was going to be
|
||||
unloaded or released."
|
||||
@callbacks = {}
|
||||
|
||||
add: (callback) ->
|
||||
id = Math.random().toString()
|
||||
@callbacks[id] = callback
|
||||
id
|
||||
|
||||
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]
|
Loading…
Add table
Add a link
Reference in a new issue