Constructor
new Signal(objectopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
object |
Object |
<optional> |
null | an optional object that owns and emits the signal |
- Source:
Methods
connect(handler, onceopt) → {qui.base.Signal}
Add a handler to the signal. This function doesn't check for duplicates, so if a handler is bound more than once to the same signal, it will be called multiple times when the signal is emitted.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
handler |
qui.base.Signal.SignalHandler | the handler function to add |
||
once |
Boolean |
<optional> |
false | optionally set this to |
- Source:
Returns:
this signal
- Type
- qui.base.Signal
disconnect(handleropt) → {qui.base.Signal}
Remove a handler from the signal.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
handler |
qui.base.Signal.SignalHandler |
<optional> |
the handler function to disconnect |
- Source:
Returns:
this signal
- Type
- qui.base.Signal
disconnectAll() → {qui.base.Signal}
Remove all handlers from the signal.
- Source:
Returns:
this signal
- Type
- qui.base.Signal
emit() → {*}
Emit the signal. All the handler functions will be called in the order of binding, until one of them returns
false
.
Any additional arguments to this function will be passed to the handlers.
The handler functions are called with this
set to the owner object of the signal.
- Source:
Returns:
the value returned by the last called handler
- Type
- *
Type Definitions
SignalHandler()
A signal handler.
- Source: