Type of the callback function.
Creates a new Callbacks instance.
Type of the callback function.
Optional
name: CallbacksNameOptional name for the Callbacks instance, used for debugging and error reporting.
Protected
Readonly
callbacksArray of callbacks.
Readonly
nameName of the Callbacks instance. This is used for debugging and error reporting.
Adds a callback to the collection. If the callback is already present, it will not be added again.
The callback function to add.
Calls all callbacks in the collection with the provided arguments. If any callback throws an error, it will be collected and thrown as a CallbackError after all callbacks have been called.
Arguments to pass to the callbacks.
CallbackError If any callback throws an error, a CallbackError will be thrown containing all errors. The CallbackError will include the name of the Callbacks instance if it was provided.
Removes a callback from the collection. If the callback is not present, it will do nothing.
The callback function to remove.
Collection of callbacks that can be added, removed and called.