rbuckton/prex

Tag new version

Closed this issue · 4 comments

Hi there,
Please tag the new npm version (i.e. 0.4.7) of this module in this upstream repo.. we want to pack this awesome npm module to debian, so please do as soon as possible,

Regards,
VIVEK K J
www.vivekkj.me
Debian Community

The prex package is essentially deprecated, as I've moved all of the functionality to @esfx/async (GitHub), which is essentially a collection of the following packages:

Existing APIs:

New Async Coordination APIs:

DOM Interop APIs:

The @esfx/cancelable package is based on tc39/proposal-cancellation#22.

As far as the differences between cancellation primitives:

Creating a "source" for cancellation

// prex
import { CancellationTokenSource } from "prex";
const source = new CancellationTokenSource();
source.token; // gets the token
source.cancel(); // cancels the source

// @esfx/async-canceltoken
import { CancelToken } from "@esfx/async-canceltoken";
const source = CancelToken.source();
source.token; // gets the token
source.cancel(); // cancels the source

Creating a "token" linked to multiple tokens

// prex
import { CancellationTokenSource } from "prex";
const outer = new CancellationTokenSource();
const inner1 = new CancellationTokenSource([outer]);
const inner2 = new CancellationTokenSource([outer]);
const token1 = inner1.token; // token canceled when either outer or inner1 are canceled
const token2 = inner2.token; // token canceled when either outer or inner2 are canceled
inner1.cancel(); // cancels 'token1'
outer.cancel(); // cancels 'token1' and 'token2'

// @esfx/async-canceltoken
import { CancelToken } from "prex";
const outer = CancelToken.source();
const inner1 = CancelToken.source();
const inner2 = CancelToken.source();
const token1 = CancelToken.race([outer, inner1]); // token canceled when either outer or inner1 are canceled
const token2 = CancelToken.race([outer, inner2]); // token canceled when either outer or inner2 are canceled
inner1.cancel(); // cancels 'token1'
outer.cancel(); // cancels 'token1' and 'token2'

Subscribing to a "token"

// prex
import { CancellationTokenSource } from "prex";
const source = new CancellationTokenSource();
const token = source.token;
const registration = token.register(() => { /* called when canceled */ });
registration.unregister(); // stop listening for cancelation

// @esfx/async-canceltoken
import { CancelToken } from "@esfx/async-canceltoken";
const source = CancelToken.source();
const token = source.token;
const subscription = token.subscribe(() => { /* called when canceled */ });
subscription.unsubscribe(); // stop listening for cancellation

// alternatively, subscriptions also support the @esfx/disposable core API
// based on https://github.com/tc39/proposal-explicit-resource-management
import { Disposable } from "@esfx/disposable";
subscription[Disposable.dispose]();

But while running the gulp test on esfx pacakge, it shows prex as a dependency, that is why I said you to tag new version in this package...

pravi commented

@rbuckton can you remove the build dependency on prex from esfx?

I've removed prex as a devDependency, and will be pushing an update to esfx with the change shortly.