The first CallbackNode
The last CallbackNode
Add the callback to the callback list.
The callback is added to the end of the callback list.
Return a handle object that represents the callback. The handle can be used to remove this callback or to insert additional callbacks before this callback.
If append
is called in another callback during the invoking of the callback list, the new callback is guaranteed not to be triggered during the same callback list invoking.
The time complexity is O(1).
Invoke each callbacks in the callback list.
The callbacks are called with arguments arg1
, arg2
, etc.
Note the arguments are passed in an array, similar to Function.prototype.apply.
Invoke each callbacks in the callback list.
The callbacks are called with arguments arg1
, arg2
, etc.
Return true if the callback list is empty.
Apply func to all callbacks. func must return a boolean value, and if the return value is false, forEachIf stops the looping immediately.
Return true if all callbacks are invoked, or event is not found, false if func returns false.
Return true if the callback list contains callback.
callback can be a callback function, or a handle object.
Return true if the callback list contains any callback.
Insert the callback to the callback list before the callback before. If before is not found, callback is added at the end of the callback list.
before can be a callback function, or a handle object.
Return a handle object that represents the callback. The handle can be used to remove this callback or to insert additional callbacks before this callback.
If insert
is called in another callback during the invoking of the callback list, the new callback is guaranteed not to be triggered during the same callback list invoking.
The time complexity is O(1).
Add the callback to the callback list.
The callback is added to the beginning of the callback list.
Return a handle object that represents the callback. The handle can be used to remove this callback or to insert additional callbacks before this callback.
If prepend
is called in another callback during the invoking of the callback list, the new callback is guaranteed not to be triggered during the same callback list invoking.
The time complexity is O(1).
Remove the callback from the callback list.
callback can be a callback function, or a handle object.
Return true if the callback is removed successfully, false if the callback is not found.
The time complexity is O(1).
Generated using TypeDoc
CallbackList is the fundamental class in quick-event. The other classes EventDispatcher and EventQueue are built on CallbackList.
CallbackList holds a list of callbacks. At the time of the call, CallbackList simply invokes each callback one by one. Consider CallbackList as the signal/slot system in Qt, or the callback function pointer in some Windows APIs (such as lpCompletionRoutine in ReadFileEx). The callback can be any functions.
Nested callback safety