Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 1x 1x 1x 1x 1x 39x 39x 39x 39x | import { caller } from 'postmsg-rpc' import callbackify from 'callbackify' import defer from 'pull-defer' import toStream from 'pull-stream-to-stream' import PMS from 'pull-postmsg-stream' import { post } from 'prepost' export default function (opts) { const api = { ping: callbackify.variadic(caller('ipfs.ping', opts)), pingPullStream: (() => { const pingPullStream = post( caller('ipfs.pingPullStream', opts), (res) => PMS.source(res.name, opts) ) return (...args) => { const deferred = defer.source() pingPullStream(...args) .then((res) => deferred.resolve(res)) .catch((err) => deferred.abort(err)) return deferred } })(), pingReadableStream () { return toStream.source(api.pingPullStream(...arguments)) } } return api } |