nuclear-instance-container
Version:
A nuclear-js module to save arbitrary objects as instances. To be used as a singleton registry for a nuclear-js app.
32 lines (28 loc) • 659 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.set = set;
exports.unset = unset;
var _actionTypes = require('./actionTypes');
/**
* Action to set an instance for a key.
*
* @public
* @param {Nuclear.Reactor} reactor
* @param {string} key
* @param {object} instance
*/
function set(reactor, key, instance) {
reactor.dispatch(_actionTypes.SET_INSTANCE, { key: key, instance: instance });
}
/**
* Action to unset an instance for a key.
*
* @public
* @param {Nuclear.Reactor} reactor
* @param {string} key
*/
function unset(reactor, key) {
reactor.dispatch(_actionTypes.UNSET_INSTANCE, { key: key });
}