ntcore-ts-client
Version:
A TypeScript library for communication over [WPILib's NetworkTables 4.1 protocol](https://github.com/wpilibsuite/allwpilib/blob/main/ntcore/doc/networktables4.adoc).
35 lines (34 loc) • 1.57 kB
TypeScript
import { NetworkTablesBaseTopic } from './base-topic';
import type { CallbackFn } from './base-topic';
import type { PubSubClient } from './pubsub';
import type { AnnounceMessageParams, NetworkTablesTypes, SubscribeOptions } from '../types/types';
export declare class NetworkTablesPrefixTopic extends NetworkTablesBaseTopic<NetworkTablesTypes> {
readonly type = "prefix";
/**
* Creates a new topic. This should only be done after the
* base NTCore client has been initialized.
* @param client - The client that owns the topic.
* @param name - The name of the topic.
*/
constructor(client: PubSubClient, name: string);
/** */
/** */
/**
* Creates a new subscriber.
* @param callback - The callback to call when the topic value changes.
* @param options - The options for the subscriber.
* @param id - The UID of the subscriber.
* @param save - Whether to save the subscriber.
* @returns The UID of the subscriber.
*/
subscribe(callback: CallbackFn<NetworkTablesTypes>, options?: Omit<SubscribeOptions, 'prefix'>, id?: number, save?: boolean): number;
resubscribeAll(client: PubSubClient): void;
/**
* Updates the value of a subtopic. Notifies all subscribers of the change.
* @param params - The params of the subtopic
* @param value - The value of the subtopic
* @param serverTime - The time the value was updated
*/
updateValue(params: AnnounceMessageParams, value: NetworkTablesTypes, serverTime: number): void;
private notifySubscribers;
}