UNPKG

textiot

Version:

A framework for building web and native (IoT) Dapps on the IPFS network

21 lines (20 loc) 941 B
import { API } from '../core/api'; import { ApiOptions } from '../models'; import { ReadableStream } from 'web-streams-polyfill/ponyfill'; declare class EventSubscription { cancel: () => void; constructor(cancel: () => void); } /** * Events is an API to stream updates from an ipfs pubsub */ export default class Events extends API { private pubsubQueryResultListeners; private queryDoneListeners; private queryErrorListeners; constructor(opts?: ApiOptions); addPubsubQueryResultListener(listener: (queryId: string, message: string, messageId: string) => void, queryId: string, queryHandle: EventSource | ReadableStream<ArrayBuffer>): ReadableStream<ArrayBuffer> | EventSubscription; addQueryDoneListener(listener: (queryId: string) => void, queryId: string): EventSubscription; addQueryErrorListener(listener: (queryId: string, error: string) => void, queryId: string): EventSubscription; } export {};