Class LoroCounter

The handler of a counter container.

Constructors

  • Create a new LoroCounter.

    Returns LoroCounter

Properties

The container id of this handler.

value: number

Get the value of the counter.

Methods

  • Decrement the counter by the given value.

    Parameters

    • value: number

    Returns void

  • Returns void

  • Get the attached container associated with this.

    Returns an attached Container that equals to this or created by this, otherwise undefined.

    Returns LoroTree<Record<string, unknown>>

  • Get the value of the counter.

    Returns number

  • Increment the counter by the given value.

    Parameters

    • value: number

    Returns void

  • Whether the container is attached to a docuemnt.

    If it's detached, the operations on the container will not be persisted.

    Returns boolean

  • "Counter"

    Returns "Counter"

  • Get the parent container of the counter container.

    • The parent container of the root counter is undefined.
    • The object returned is a new js object each time because it need to cross the WASM boundary.

    Returns Container

  • Subscribe to the changes of the counter.

    Parameters

    • f: Function

    Returns any