Options
All
  • Public
  • Public/Protected
  • All
Menu

A Replicated Register data type.

remarks

A ReplicatedRegister uses a clock to determine which of two concurrent updates should win. The last write wins. The clock is represented as a number. The default clock uses the proxies system time, custom clocks can supply a custom number to be used. If two clock values are equal, the write from the node with the lowest address wins.

Type Parameters

Hierarchy

  • ReplicatedRegister

Implements

Index

Constructors

Accessors

Methods

Constructors

  • new ReplicatedRegister<Value>(value: Value, clock?: number, customClockValue?: number | Long): ReplicatedRegister<Value>
  • Create a new Replicated Register.

    Type Parameters

    Parameters

    • value: Value

      A value to hold in the register

    • clock: number = Clocks.DEFAULT

      The clock to use, otherwise default clock

    • customClockValue: number | Long = 0

      The custom clock value, if using a custom clock

    Returns ReplicatedRegister<Value>

Accessors

  • get value(): Value
  • set value(value: Value): void

Methods

  • setWithClock(value: Value, clock?: number, customClockValue?: number | Long): ReplicatedRegister<Value>
  • Set the value using a custom clock.

    Parameters

    • value: Value

      The value to set

    • clock: number = Clocks.DEFAULT

      The clock, otherwise the default clock

    • customClockValue: number | Long = 0

      Custom clock value, or ignored if a custom clock isn't specified

    Returns ReplicatedRegister<Value>

  • toString(): string

Generated using TypeDoc