Typesafe signal.

Methods

connect(callback:T):Void

Connects the signal to the callback.

A signal can only be connected once to a callback. It will throw an error if already connected. To avoid this, first, use isConnected to check for existing connections.

disconnect(callback:T):Void

Disconnects the signal from the callback.

If you try to disconnect a connection that does not exist, the method will throw an error. Use isConnected to ensure that the connection exists.

emitSignal(args:Rest<Any>):Void

Emit the signal.

The arguments type and number are checked at compile time.

isConnected(callback:T):Bool

Returns true if a connection exists between this signal and the callback.