Skip to main content

Class: HatTokenMap

core/HatTokenMap.HatTokenMap

Maps from (hatStyle, character) pairs to tokens

Constructors

constructor

new HatTokenMap(graph)

Parameters

NameType
graphGraph

Defined in

core/HatTokenMap.ts:34

Properties

activeMap

Private activeMap: IndividualHatMap

This is the active map the changes every time we reallocate hats. It is liable to change in the middle of a phrase.

Defined in

core/HatTokenMap.ts:21


hatAllocator

Private hatAllocator: HatAllocator

Defined in

core/HatTokenMap.ts:32


lastSignalVersion

Private lastSignalVersion: null | string = null

Defined in

core/HatTokenMap.ts:31


prePhraseMapSnapshot

Private Optional prePhraseMapSnapshot: IndividualHatMap

This is a snapshot of the hat map that remains stable over the course of a phrase. Ranges will be updated to account for changes to the document, but a hat with the same color and shape will refer to the same logical range.

Defined in

core/HatTokenMap.ts:28


prePhraseMapsSnapshotTimestamp

Private prePhraseMapsSnapshotTimestamp: null | bigint = null

Defined in

core/HatTokenMap.ts:29

Methods

addDecorations

addDecorations(): Promise<void>

Returns

Promise<void>

Defined in

core/HatTokenMap.ts:49


dispose

dispose(): void

Returns

void

Defined in

core/HatTokenMap.ts:107


getActiveMap

Private getActiveMap(): Promise<IndividualHatMap>

Returns

Promise<IndividualHatMap>

Defined in

core/HatTokenMap.ts:53


getReadableMap

getReadableMap(usePrePhraseSnapshot): Promise<ReadOnlyHatMap>

Returns a transient, read-only hat map for use during the course of a single command.

Please do not hold onto this copy beyond the lifetime of a single command, because it will get stale.

Parameters

NameTypeDescription
usePrePhraseSnapshotbooleanWhether to use pre-phrase snapshot

Returns

Promise<ReadOnlyHatMap>

A readable snapshot of the map

Defined in

core/HatTokenMap.ts:70


init

init(): Promise<void>

Returns

Promise<void>

Defined in

core/HatTokenMap.ts:45


maybeTakePrePhraseSnapshot

Private maybeTakePrePhraseSnapshot(): Promise<void>

Returns

Promise<void>

Defined in

core/HatTokenMap.ts:115


takePrePhraseSnapshot

Private takePrePhraseSnapshot(): void

Returns

void

Defined in

core/HatTokenMap.ts:132