Closed rictic closed 7 years ago
Feature proposal, as a lightweight alternative to await.cancelToken. Roughly equivalent to:
await.cancelToken
class CancelToken { or(thenable) { return new Promise((resolve, reject) => { this.promise.catch(reject); thenable.then(resolve, reject); }); } }
Usage:
async longRunning(cancelToken) { await cancelToken.or(uncancellableTask()); await cancellableTask(cancelToken); }
Feature proposal, as a lightweight alternative to
await.cancelToken
. Roughly equivalent to:Usage: