Skip to content

editorGlobalsCacheMap

Class: CacheMap ‹K, V

A proxy around a generator function that caches the computation result for each input

Type parameters

K

V

Hierarchy

  • CacheMap

Index

Constructors

Properties

Methods

Constructors

constructor

+ new CacheMap(generator: function): CacheMap

Defined in src/util/CacheMap.ts:6

Parameters:

generator: function

the function to compute not-yet-cached values

▸ (k: K): V

Parameters:

Name Type
k K

Returns: CacheMap

Properties

Private Readonly generator

generator: function

Defined in src/util/CacheMap.ts:6

Type declaration:

▸ (k: K): V

Parameters:

Name Type
k K

Private map

map: Map‹K, V› = new Map()

Defined in src/util/CacheMap.ts:5

Methods

get

get(key: K): V

Defined in src/util/CacheMap.ts:18

Get a cached result, if any, or compute it if needed, and cache it.

Parameters:

Name Type
key K

Returns: V