Evt.create(initalState?)
Static method to instanciate an Evt or a StatefulEvt.
Usage
import { Evt, VoidEvt, StatefulEvt } from "evt";
Evt.create<string>() ⇔ new Evt<string>()
Evt.create() ⇔ /* An object that implement VoidEvt */
Evt.create(false) ⇔ new StatefulEvt<boolean>(false)Why VoidEvt and not Evt<void> ?
VoidEvt and not Evt<void> ?import { Evt } from "evt";
const evtSocketConnect = Evt.create();
evtSocketConnect.attach(() => console.log("SOCKET CONNECTED"));
evtSocketConnect.post();
//"SOCKET CONNECTED" have been printed on the console.Last updated