2013-04-26 13:14:29 +00:00
|
|
|
IDWeakMap = require 'id_weak_map'
|
2013-04-24 08:43:01 +00:00
|
|
|
|
2013-04-26 13:14:29 +00:00
|
|
|
globalStore = {}
|
|
|
|
globalMap = new IDWeakMap
|
2013-04-24 08:43:01 +00:00
|
|
|
|
2013-04-26 13:14:29 +00:00
|
|
|
getStoreForRenderView = (process_id, routing_id) ->
|
|
|
|
key = "#{process_id}_#{routing_id}"
|
|
|
|
globalStore[key] = {} unless globalStore[key]?
|
|
|
|
globalStore[key]
|
2013-04-24 08:43:01 +00:00
|
|
|
|
2013-04-26 13:14:29 +00:00
|
|
|
exports.add = (process_id, routing_id, obj) ->
|
|
|
|
id = globalMap.add obj
|
|
|
|
store = getStoreForRenderView process_id, routing_id
|
|
|
|
store[id] = obj
|
|
|
|
id
|
2013-04-24 08:43:01 +00:00
|
|
|
|
2013-04-26 13:14:29 +00:00
|
|
|
exports.get = (process_id, routing_id, id) ->
|
|
|
|
globalMap.get id
|
2013-04-24 08:43:01 +00:00
|
|
|
|
2013-04-26 13:14:29 +00:00
|
|
|
exports.remove = (process_id, routing_id, id) ->
|
|
|
|
store = getStoreForRenderView process_id, routing_id
|
|
|
|
delete store[id]
|