Skip to content

signal.um

Marek Maskarinec edited this page Oct 9, 2022 · 2 revisions

signal.um

 A module for importless communication between modules. A signal is an array
 of callbacks with a name.

struct Any*

type Any* = interface{}

struct Callback*

type Callback* = fn(ctx: Any) 

struct Signal*

type Signal* = []Callback

fn register*

fn register*(name: str, callback: Callback) {

Registers a callback to a signal. There is no need to explicitely create signals.

fn emit*

fn emit*(name: str, ctx: Any) {

Calls all callbacks associated with the passed name.

Clone this wiki locally