githubEdit

Evt.newCtx<T>()

Get a new instance of Ctx

The recommended way to get a new Ctxarrow-up-right instance. The type argument is optional, default is void.

Returns

Example

import { Evt } from "evt";

const ctx = Evt.newCtx();

ctx.getPrDone().then(()=> console.log("DONE"));

ctx.done(); //Prints "DONE"

//----------------------------

const ctxData = Evt.newCtx<Uint8Array>();

ctxText.getPrDone().then(
    data=> console.log(`DONE: ${data.byteLength} bytes`)
);

ctxText.done(new Uint8Array([1,2,3])); //Prints "DONE: 3 bytes"

****Run the examplearrow-up-right****

Last updated

Was this helpful?