Interface LiveCounterBatchContext

LiveCounterBatchContext is a batch context wrapper for a LiveCounter object.

Hierarchy

Properties

id: undefined | string

Get the object ID of the underlying instance.

If the underlying instance at runtime is not a LiveObject, returns undefined.

Methods

  • Get a number representation of the counter instance. This is an alias for calling value().

    If the underlying instance's value is not of the expected type at runtime, returns undefined.

    Returns undefined | number

  • Get a number representation of the counter instance. This is an alias for calling value().

    If the underlying instance's value is not of the expected type at runtime, returns undefined.

    Returns undefined | number

  • Adds an operation to the current batch to increment the value of the underlying LiveCounterInstance. All queued operations are sent together in a single message once the batch function completes.

    If the underlying instance at runtime is not a counter, this method throws an error.

    This does not modify the underlying data of the counter. Instead, the change is applied when the published operation is echoed back to the client and applied to the object. To get notified when object gets updated, use PathObject.subscribe or Instance.subscribe, as appropriate.

    Parameters

    • Optional amount: number

      The amount by which to increase the counter value. If not provided, defaults to 1.

    Returns void

  • Get the current value of the counter instance. If the underlying instance at runtime is not a counter, returns undefined.

    Returns undefined | number

Generated using TypeDoc