@yorkie-js/sdk
    Preparing search index...

    Class DedupCounter

    DedupCounter is a Counter that uses HyperLogLog to count unique actors. Use add(actor) to record a unique visitor. Provides approximate counts with ~2% error rate.

    doc.update((root) => {
    root.uv = new yorkie.DedupCounter();
    root.uv.add(userId);
    });

    Hierarchy

    • BaseCounter
      • DedupCounter
    Index

    Constructors

    Properties

    context?: ChangeContext<Indexable>
    counter?: CRDTCounter
    value: number | bigint
    valueType: CounterType

    Methods

    • ensureInitialized throws if this counter has not been initialized.

      Returns void

    • getValue returns the value of this counter. Always a number since DedupCounter only supports IntDedup.

      Returns number

    • initialize links this proxy to a ChangeContext and CRDTCounter.

      Parameters

      • context: ChangeContext
      • counter: CRDTCounter

      Returns void