mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-14 16:38:39 +00:00
Fixes #14
This commit is contained in:
parent
9d51b089aa
commit
4b8b17fa87
|
|
@ -104,12 +104,31 @@
|
||||||
this.callbacks[group].func();
|
this.callbacks[group].func();
|
||||||
|
|
||||||
if (this.callbacks[group].remove) {
|
if (this.callbacks[group].remove) {
|
||||||
delete this.callbacks[group];
|
this.detach(group);
|
||||||
delete this.groups[group];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detach event
|
||||||
|
*
|
||||||
|
* @param {string|int} group Group id
|
||||||
|
* @param {function} callback Callback
|
||||||
|
* @param {boolean} remove Should be removed after execution
|
||||||
|
*
|
||||||
|
* @return {void}
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
jsOMS.Event.EventManager.prototype.detach = function (group)
|
||||||
|
{
|
||||||
|
delete this.callbacks[group];
|
||||||
|
delete this.groups[group];
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach callback to event group
|
* Attach callback to event group
|
||||||
*
|
*
|
||||||
|
|
@ -117,7 +136,7 @@
|
||||||
* @param {function} callback Callback
|
* @param {function} callback Callback
|
||||||
* @param {boolean} remove Should be removed after execution
|
* @param {boolean} remove Should be removed after execution
|
||||||
*
|
*
|
||||||
* @return {boolean}
|
* @return {void}
|
||||||
*
|
*
|
||||||
* @method
|
* @method
|
||||||
*
|
*
|
||||||
|
|
@ -130,4 +149,19 @@
|
||||||
|
|
||||||
this.callbacks[group] = {remove: remove, func: callback};
|
this.callbacks[group] = {remove: remove, func: callback};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count events
|
||||||
|
*
|
||||||
|
* @return {int}
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
jsOMS.Event.EventManager.prototype.count = function ()
|
||||||
|
{
|
||||||
|
return this.callbacks.length;
|
||||||
|
};
|
||||||
}(window.jsOMS = window.jsOMS || {}));
|
}(window.jsOMS = window.jsOMS || {}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user