Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("throws when token is canceled", async () => {
await expect(new AsyncMutex().lock(Cancelable.canceled)).rejects.toThrow(CancelError);
});
});
subscribe(onSignaled) {
if (state === "closed") {
return Cancelable.none.subscribe(onSignaled);
}
if (state === "signaled") {
return Cancelable.canceled.subscribe(onSignaled);
}
const list = subscriptions || (subscriptions = new LinkedList());
return createCancelSubscription(list.push(onSignaled));
}
}));