EVT
Search…
Evt.newCtx<T>()
Get a new instance of Ctx
The recommended way to get a new Ctx instance. The type argument is optional, default is void.

Returns

    Ctx<T> if a type argument was specified
    VoidCtx if no type argument was speficied.

Example

1
import { Evt } from "evt";
2
3
const ctx = Evt.newCtx();
4
5
ctx.getPrDone().then(()=> console.log("DONE"));
6
7
ctx.done(); //Prints "DONE"
8
9
//----------------------------
10
11
const ctxData = Evt.newCtx<Uint8Array>();
12
13
ctxText.getPrDone().then(
14
data=> console.log(`DONE: ${data.byteLength} bytes`)
15
);
16
17
ctxText.done(new Uint8Array([1,2,3])); //Prints "DONE: 3 bytes"
Copied!
Last modified 1yr ago
Copy link