ReferenceScripting APISignal
Signal
classAn event others can bind to: sent by one, heard by any number.
| Name | Signal |
|---|---|
| Kind | class |
| Script reaches it as | import { Signal } from "motion" |
| Since | 0.3 |
Syntax
class Signal { … }Methods
| Signature | Description |
|---|---|
new Signal<Values extends unknown[]>(): Signal<Values>constructor | A new signal, with nothing listening yet. |
bind(fn: (...values: Values) => void): (...values: Values) => voidmethod | Listens to it. |
unbind(fn: (...values: Values) => void): voidmethod | Stops listening. |
once(fn: (...values: Values) => void): (...values: Values) => voidmethod | Listens to it once. |
send(...values: Values): voidmethod | Sends it to everything listening. |
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.