You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
399 B
23 lines
399 B
var State = require('./State');
|
|
var actions = Object.create(null);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
module.exports = {
|
|
level: 0,
|
|
|
|
subscribe(event, callback) {
|
|
if (actions[event] === undefined) {
|
|
actions[event] = [];
|
|
}
|
|
|
|
actions[event].push(callback);
|
|
},
|
|
|
|
publish(event) {
|
|
actions[event].forEach(function(callback) {
|
|
callback();
|
|
});
|
|
}
|
|
};
|
|
|