A type alias for the exception handler function.
Construct a new signal.
The sender which owns the signal.
The sender which owns the signal.
Connect a slot to the signal.
The slot to invoke when the signal is emitted.
The this
context for the slot. If provided,
this must be a non-primitive object.
true
if the connection succeeds, false
otherwise.
Disconnect a slot from the signal.
The slot to disconnect from the signal.
The this
context for the slot. If provided,
this must be a non-primitive object.
true
if the connection is removed, false
otherwise.
Emit the signal and invoke the connected slots.
The args to pass to the connected slots.
Slots are invoked synchronously in connection order.
Exceptions thrown by connected slots will be caught and logged.
Clear all signal data associated with the given object.
The object for which the data should be cleared.
This removes all signal connections and any other signal data associated with the object.
Remove all connections where an object is the sender or receiver.
The object of interest.
If a thisArg
is provided when connecting a signal, that object
is considered the receiver. Otherwise, the slot
is considered
the receiver.
Remove all connections between a sender and receiver.
The sender object of interest.
The receiver object of interest.
If a thisArg
is provided when connecting a signal, that object
is considered the receiver. Otherwise, the slot
is considered
the receiver.
Remove all connections where the given object is the receiver.
The receiver object of interest.
If a thisArg
is provided when connecting a signal, that object
is considered the receiver. Otherwise, the slot
is considered
the receiver.
Remove all connections where the given object is the sender.
The sender object of interest.
Get the signal exception handler.
The current exception handler.
The default exception handler is console.error
.
Set the signal exception handler.
The function to use as the exception handler.
The old exception handler.
The exception handler is invoked when a slot throws an exception.
Generated using TypeDoc
A concrete implementation of
ISignal
. The namespace for theSignal
class statics.Example
import { ISignal, Signal } from '@phosphor/signaling'; class SomeClass { constructor(name: string) { this.name = name; } readonly name: string; get valueChanged: ISignal<this, number> { return this._valueChanged; } get value(): number { return this._value; } set value(value: number) { if (value === this._value) { return; } this._value = value; this._valueChanged.emit(value); } private _value = 0; private _valueChanged = new Signal<this, number>(this); } function logger(sender: SomeClass, value: number): void { console.log(sender.name, value); } let m1 = new SomeClass('foo'); let m2 = new SomeClass('bar'); m1.valueChanged.connect(logger); m2.valueChanged.connect(logger); m1.value = 42; // logs: foo 42 m2.value = 17; // logs: bar 17