UNPKG

textiot

Version:

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

21 lines (20 loc) 927 B
import { API } from '../core/api'; import { FeedItem, Block } from '../models'; import { ReadableStream } from 'web-streams-polyfill/ponyfill'; /** * Observe is an API to stream updates from a thread or all threads */ export default class Observe extends API { /** * Observe to updates in a thread or all threads * An update is generated when a new block is added to a thread. See [[Block.BlockType]] for * details and a list of block types to which you can observe. * * @param types List of event types to stream (e.g., ['FILES', 'COMMENTS', 'LIKES']. Leave * undefined or empty to include all types. * @param thread Limit updates to a single thread. Leave undefined or an empty stream to * stream events across all threads. * @returns A ReadableStream of FeedItem objects. */ events(types?: Block.BlockType[], thread?: string): Promise<ReadableStream<FeedItem>>; }