UNPKG

raiden-ts

Version:

Raiden Light Client Typescript/Javascript SDK

24 lines 988 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* eslint-disable @typescript-eslint/no-explicit-any */ require("isomorphic-fetch"); require("abort-controller/polyfill"); require("./logger"); const matrix_js_sdk_1 = require("matrix-js-sdk"); let request; /** * The original request doesn't error-callback when abort'ing, required to teardown subscriptions */ (0, matrix_js_sdk_1.wrapRequest)((origRequest, opts, cb) => { // matrix-js-sdk uses `import * as request`, which breaks calling default export as function; // here we make use of `forever` method to get back the `request` callable api request ?? (request = 'forever' in origRequest ? origRequest.forever(undefined, undefined) : origRequest); const req = request(opts, cb); const origAbort = req.abort; req.abort = function abort() { origAbort.call(this); cb(new Error('aborted!'), null, null); }; return req; }); //# sourceMappingURL=polyfills.js.map