Interface LiveCounter

The LiveCounter class represents a counter that can be incremented or decremented and is synchronized across clients in realtime.

Hierarchy

Methods

  • Experimental

    An alias for calling LiveCounter.increment(-amount)

    Parameters

    • amount: number

      The amount by which to decrease the counter value.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Experimental

    Sends an operation to the Ably system to increment the value of this LiveCounter object.

    This does not modify the underlying data of this object. 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 the subscribe method.

    Parameters

    • amount: number

      The amount by which to increase the counter value.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Experimental

    Removes all registrations that match both the specified listener and the specified event.

    Parameters

    Returns void

  • Experimental

    Deregisters all registrations, for all events and listeners.

    Returns void

  • Experimental

    Returns the current value of the counter.

    Returns number

Generated using TypeDoc