module:MSignal

module:MSignal

Class to implement and emit custom signals.

Constructor

new (require("MSignal"))(sender)

Description:
  • Constructor.

Parameters:
Name Type Description
sender Object

Sender object. If not provided this will be used as the sender.

Methods

slots() → {Array.<MSlot>}

Description:
  • Property method.

Returns:

Slots.

Type
Array.<MSlot>

hasSlot(slot) → {number}

Description:
  • Check whether this signal has given slot connected.

Parameters:
Name Type Description
slot function

Function.

Returns:

Index number of the slot in _slots array. -1 if it doesn't exist.

Type
number

connect(slot)

Description:
  • Connect given slot.

Parameters:
Name Type Description
slot function

Function or method.

disconnect(slot)

Description:
  • Disconnect given slot.

Parameters:
Name Type Description
slot function

Function or method.

emit(…args)

Description:
  • Emit the signal.

Parameters:
Name Type Attributes Description
args * <repeatable>

Arguments.