Skip to main content
Module

x/evt/test/test83.ts

💧EventEmitter's typesafe replacement
Go to Latest
File

import { Evt, VoidEvt, matchVoid } from "../lib/index.ts";import { assert } from "../tools/typeSafety/index.ts";
const voidEvt = Evt.create();
const evt: Evt<string> | VoidEvt = voidEvt as any;
let count = 0;
Evt.factorize(evt).attach(data => {
if (matchVoid(data)) {
count++; return;
}
data.toUpperCase();

});
voidEvt.post();voidEvt.postAsyncOnceHandled();
assert(count === 2);
console.log("PASS");