You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {Generator} generator - A generator that yields promises, and returns a value or throws an error when finished.
* @returns {[Function, Promise]} A tuple `[cancel, promise]`. Calling `cancel()` throws "Cancelled" into the generator if it hasn't finished. `promise` resolves with the generator's return value, or rejects with whatever error propagates out of it (including an uncaught "Cancelled").
*/
function cancellable(generator) {
let cancelRequested = false;
let cancelDelivered = false;
let cancel = () => {};
const cancelPromise = new Promise((resolve, reject) => {