Private
disconnectThis flag is to safely handle DisconnectAll while firing. When enabled we stop looping callbacks for the current Fire.
Private
queuedMap from priority to all callbacks queued at that priority. Holds connections that were registered while this signal was firing (to be added after fire completes).
Connect a callback function to the signal.
The returned function can be called to disconnect the callback.
Connect a callback function to the signal. Highest SignalPriority is called first.
The returned function can be called to disconnect the callback.
Invokes all callback functions with the given arguments.
Rest
...args: Parameters<[T] extends [unknown[]]Connects a callback function to the signal. The connection is automatically disconnected after the first invocation.
The returned function can be called to disconnect the callback.
Private
RegisterA yieldable signal is one in which calling Fire()
may yield if
any connected function handlers yield. This also means that all events
will run in series. The default behavior is false
, where the signal
will call event handlers in separate threads, thus calling Fire()
will
not yield by default.
Note: When using Cancellable events and not allowing Fire()
to yield,
then any connected handlers that do yield will throw a warning.
// Example:
const signal = new Signal().WithAllowYield(true);
A Signal is an object that is used to dispatch and receive arbitrary events.