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.
Methods
Section titled “Methods”ensure()
Section titled “ensure()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
slug | string |
Returns
Section titled “Returns”boolean
onResolved()
Section titled “onResolved()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener | () => void |
Returns
Section titled “Returns”() => void
peek()
Section titled “peek()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
slug | string |
Returns
Section titled “Returns”| MojiDefinition
| null
| undefined