UNPKG

@ceramicnetwork/core

Version:

Typescript implementation of the Ceramic protocol

18 lines 524 B
import { Observable } from 'rxjs'; export function deferAbortable(fn) { return new Observable((subscriber) => { const abortController = new AbortController(); fn(abortController.signal) .then((value) => { subscriber.next(value); subscriber.complete(); }) .catch((error) => { subscriber.error(error); }); return () => { abortController.abort(); }; }); } //# sourceMappingURL=defer-abortable.js.map