Skip to content

ntcore-ts / @ntcore-ts/react / UseProtobufTopicOptions

Type Alias: UseProtobufTopicOptions<T> ​

UseProtobufTopicOptions<T> = object

Defined in: react/src/lib/use-protobuf-topic.ts:12

Options for useProtobufTopic (defaultValue, validator, protoFilePath, protoSource, messageType, subscribeOptions, publish). validator is a Zod schema for the decoded message type.

Type Parameters ​

T ​

T extends object

Properties ​

defaultValue? ​

optional defaultValue?: T

Defined in: react/src/lib/use-protobuf-topic.ts:13


messageType? ​

optional messageType?: Type

Defined in: react/src/lib/use-protobuf-topic.ts:17


protoFilePath? ​

optional protoFilePath?: string

Defined in: react/src/lib/use-protobuf-topic.ts:15


protoSource? ​

optional protoSource?: string

Defined in: react/src/lib/use-protobuf-topic.ts:16


publish? ​

optional publish?: true | TopicProperties

Defined in: react/src/lib/use-protobuf-topic.ts:25

Make this client the publisher of the topic so you can write with setValue.

  • true → publish with default properties (not retained).
  • { retained: true } (or other TopicProperties) → publish with those properties. When provided, only call setValue after isReadyToWrite is true.

subscribeOptions? ​

optional subscribeOptions?: SubscribeOptions

Defined in: react/src/lib/use-protobuf-topic.ts:18


unpublishOnUnmount? ​

optional unpublishOnUnmount?: boolean

Defined in: react/src/lib/use-protobuf-topic.ts:27

When publish is set, call topic.unpublish() on unmount (default true).


validator? ​

optional validator?: ZodType<T>

Defined in: react/src/lib/use-protobuf-topic.ts:14

Released under the MIT License.