Reactive

The Reactive module provides functions for creating ReactiveStateSchema and ReactiveStream objects.

It also provides an API for creating one-shot publishers, which simply publish a single value. This can be useful in more niche situations where there exists an API which can accept a publisher, but only a single value is needed by the consumer of the API.

class Reactive: LibTSMModule
staticmethod CreateStateSchema(name: string): ReactiveStateSchema

Creates a new state schema object.

Parameters:

name (string) – The name for debugging purposes

staticmethod GetStream(initialValueFunc: fun(): any): ReactiveStream

Gets a stream object.

Parameters:

initialValueFunc (fun(): any) – A function to get the initial value to send to new publishers

staticmethod GetOneShotPublisher(value: any, autoDisable?: boolean, autoStore?: table): ReactivePublisherSchema

Gets a publisher which publishes a single initial value and never again.

Parameters:
  • value (any) – The value to publish

  • autoDisable? (boolean) – Whether or not to automatically disable the publisher

  • autoStore? (table) – The table to store the publisher in automatically