@openpass/openpass-js-sdk
Version:
OpenPass SSO JavaScript SDK
19 lines • 731 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class AbortablePromise extends Promise {
constructor(executor) {
//temporary variable to get access to the abortCallback
let onAbort = undefined;
// call the promise constructor to get access to the abortCallback handler and assign it to the onAbort variable
super((rs, rj) => executor(rs, rj, (abortCallback) => (onAbort = abortCallback)));
this.onAbort = onAbort;
}
// call this method to invoke the onAbort function of the promise
abort() {
if (this.onAbort) {
this.onAbort();
}
}
}
exports.default = AbortablePromise;
//# sourceMappingURL=abortablePromise.js.map