@stellar/stellar-sdk
Version:
A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.
25 lines (22 loc) • 447 B
JavaScript
;
class CancelToken {
promise;
reason;
throwIfRequested() {
if (this.reason) {
throw new Error(this.reason);
}
}
constructor(executor) {
let resolvePromise;
this.promise = new Promise((resolve) => {
resolvePromise = resolve;
});
executor((reason) => {
this.reason = reason;
resolvePromise();
});
}
}
exports.CancelToken = CancelToken;
//# sourceMappingURL=types.js.map