electron/browser/atom/objects_registry.coffee

23 lines
312 B
CoffeeScript
Raw Normal View History

module.exports =
class ObjectsRegistry
@nextId = 0
constructor: ->
@objects = []
getNextId: ->
++ObjectsRegistry.nextId
add: (obj) ->
id = @getNextId()
@objects[id] = obj
id
remove: (id) ->
obj = @objects[id]
delete @objects[id]
obj
get: (id) ->
@objects[id]