UNPKG

raiden-ts

Version:

Raiden Light Client Typescript/Javascript SDK

22 lines 879 B
/* eslint-disable @typescript-eslint/no-explicit-any */ import 'isomorphic-fetch'; import 'abort-controller/polyfill'; import './logger'; import { wrapRequest } from 'matrix-js-sdk'; let request; /** * The original request doesn't error-callback when abort'ing, required to teardown subscriptions */ 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