mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
Fixes #14
This commit is contained in:
parent
9d51b089aa
commit
4b8b17fa87
|
|
@ -104,12 +104,31 @@
|
|||
this.callbacks[group].func();
|
||||
|
||||
if (this.callbacks[group].remove) {
|
||||
delete this.callbacks[group];
|
||||
delete this.groups[group];
|
||||
this.detach(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
|
||||
*
|
||||
|
|
@ -117,7 +136,7 @@
|
|||
* @param {function} callback Callback
|
||||
* @param {boolean} remove Should be removed after execution
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {void}
|
||||
*
|
||||
* @method
|
||||
*
|
||||
|
|
@ -130,4 +149,19 @@
|
|||
|
||||
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 || {}));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user