Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
18 lines
476 B
Plaintext
18 lines
476 B
Plaintext
var listeners = {};
|
|
var trigger = function (key, data) {
|
|
if (listeners[key]) {
|
|
listeners[key].forEach(function (item) { return item(data); });
|
|
}
|
|
};
|
|
var subscribe = function (key, listener) {
|
|
if (!listeners[key]) {
|
|
listeners[key] = [];
|
|
}
|
|
listeners[key].push(listener);
|
|
return function unsubscribe() {
|
|
var index = listeners[key].indexOf(listener);
|
|
listeners[key].splice(index, 1);
|
|
};
|
|
};
|
|
export { trigger, subscribe };
|