haystack-nclient
Version:
Project Haystack Network Client
54 lines (53 loc) • 1.85 kB
TypeScript
import { HaysonDict, HDict, HGrid, HList } from 'haystack-core';
import { Ids } from '../../util/hval';
import { ClientServiceConfig } from '../ClientServiceConfig';
import { Watch } from './Watch';
import { WatchApis } from './WatchApis';
/**
* A service for using watches.
*/
export declare class WatchService {
#private;
/**
* Constructs a service object.
*
* @param serviceConfig Service configuration.
* @param watchApis Watch network APIs implementation.
*/
constructor(serviceConfig: ClientServiceConfig, watchApis: WatchApis);
/**
* Create a new watch on the specified data.
*
* https://project-haystack.org/doc/Ops#watchSub
* https://project-haystack.org/doc/Ops#watchUnsub
* https://project-haystack.org/doc/Ops#watchPoll
*
* @param display Display name for the watch.
* @param ids The ids to watch.
* @param grid An optional empty grid to use for the watch.
* @returns An opened watch.
*/
make(display: string, ids: Ids, grid?: HGrid): Promise<Watch>;
/**
* Closes any open watches for this watch service.
*/
close(): Promise<void>;
/**
* Triggers a manual update of the watches.
*
* This is used to manually update dicts outside of a poll.
* Providing the dicts are newer and they're being watched, any
* listeners will receive the update as if they were updated from
* the server via a watch poll request.
*
* @param dicts The dicts to update.
*/
update(dicts: HDict | HaysonDict | HDict[] | HaysonDict[] | HGrid | HList<HDict>): Promise<void>;
/**
* Request a poll for all opened watches.
*
* Please note, polls are normally handled automatically so manually
* calling this is not normally required.
*/
poll(): Promise<void>;
}