Signal

The Signal class provides a mechanism to signal asynchronous events from one module to another. It is intended to be long-living and can be set and cleared multiple times safely.

API

class Signal: Class
staticmethod New(name: string): Signal

Create a new signal.

Parameters:

name (string) – The name of the signal for debugging purposes

GetName(self: Signal): string

Gets the name for debugging purposes.

Set(self: Signal)

Sets the signal

Clear(self: Signal)

Clears the signal.

IsSet(self: Signal): boolean

Clears the signal.

CallbackToSet(self: Signal): fun()

Returns a callback function which sets the signal when called.

SetHandler(self: Signal, handler?: fun(input: Signal))

Sets the handler for when the signal is set

Parameters:

handler? (fun(input: Signal)) – The handler or nil to clear the handler