evt.attach*(...)
Attach a Handler provided with a callback function to the Evt
The $ prefix
$ prefiximport { Evt } from "evt";
const evtText= new Evt<string>();
//No operator, we don't need the $ prefix
evtText.attach(text => console.log(`1: ${text}`));
//text => text.startWith("H") is a filter so we do not need the $ prefix
evtText.attach(
text => text.startWith("H"),
text => console.log(`2: ${text}`)
);
//text => [ text.toUpperCase() ] is a fλ operator, we need the $ prefix
evtText.$attach(
text => [ text.toUpperCase() ],
upperCaseText => console.log(`3: ${upperCaseText}`)
);
//Prints:
//"1: Hello World"
//"2: HelloWorld"
//"3: Hello World"
evtText.post("Hello World");
Parameters

Returned Value
evt.attach(...)
evt.attach(...)evt.attachOnce*(...)
evt.attachOnce*(...)evt.attach[Once]Prepend(...)
evt.attach[Once]Prepend(...)evt.attach[Once]Extract(...)
evt.attach[Once]Extract(...)Last updated
Was this helpful?