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
Was this helpful?