mirror of
https://github.com/atom/atom.git
synced 2026-02-10 14:45:11 -05:00
16 lines
321 B
CoffeeScript
16 lines
321 B
CoffeeScript
module.exports =
|
|
class ItemRegistry
|
|
constructor: ->
|
|
@items = new WeakSet
|
|
|
|
addItem: (item) ->
|
|
if @hasItem(item)
|
|
throw new Error("The workspace can only contain one instance of item #{item}")
|
|
@items.add(item)
|
|
|
|
removeItem: (item) ->
|
|
@items.delete(item)
|
|
|
|
hasItem: (item) ->
|
|
@items.has(item)
|