Skip to content

MojiCache

Defined in: resolver.ts:174

A slug→definition cache in front of an AsyncMojiResolver. Lookups are split into a synchronous, non-fetching peek (used by the live-conversion scan, which must never block on the network) and an asynchronous ensure that starts a fetch on a miss.

ensure(slug): boolean;

Defined in: resolver.ts:188

Start an async fetch for a cache miss. Returns false (a no-op) when the slug is already cached or a fetch is already in flight; otherwise starts a fetch and returns true. Successful results (definition or negative) are cached; a rejected fetch is left uncached so a later edit retries.

ParameterType
slugstring

boolean


onResolved(listener): () => void;

Defined in: resolver.ts:194

Subscribe to be notified after a batch of fetches settles. Multiple settlements in the same tick are coalesced into a single call (via a microtask) so the editor re-scans once per batch. Returns an unsubscribe.

ParameterType
listener() => void

() => void


peek(slug):
| MojiDefinition
| null
| undefined;

Defined in: resolver.ts:181

Synchronous, non-fetching lookup: • a MojiDefinition — resolved and cached, • null — a cached negative result (a known-unknown slug), • undefined — not cached yet (call MojiCache.ensure).

ParameterType
slugstring

| MojiDefinition | null | undefined