API reference › @evolu/common › RefCount › RefCountByKey
Defined in: packages/common/src/RefCount.ts:61
Reference counts keyed by logical identity.
By default, createRefCountByKey uses reference identity, the same as
Map keys. Callers may instead provide a lookup so logical
equality is based on a derived stable key. Decrementing a missing key is a
programmer error checked with assert.
Extends
Methods
[dispose]()
dispose: void;
Defined in: node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34
Inherited from
Disposable.[dispose]
Properties
decrement
readonly decrement: (key: TKey) => number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
Defined in: packages/common/src/RefCount.ts:71
Decrements key count and returns the new count.
Decrementing a missing key is a programmer error checked with assert.
getCount
readonly getCount: (key: TKey) => number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
Defined in: packages/common/src/RefCount.ts:74
Gets current count for key. Returns 0 when the key is not tracked.
has
readonly has: (key: TKey) => boolean;
Defined in: packages/common/src/RefCount.ts:77
Returns true when the key is tracked with count greater than zero.
increment
readonly increment: (key: TKey) => number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative"> & Brand<"Positive">;
Defined in: packages/common/src/RefCount.ts:63
Increments key count and returns the new count.
keys
readonly keys: () => ReadonlySet<TKey>;
Defined in: packages/common/src/RefCount.ts:80
Returns all currently tracked keys.