Options
All
  • Public
  • Public/Protected
  • All
Menu

Module memory

Namespaced data storage.

Index

Functions

cacheInMemory

  • cacheInMemory(name?: undefined | string): (Anonymous function)
  • Decorator to cache the result of a nullary method.

    Applying this decorator to a method in a HasMemory class will memoize the result of the method in the Memory.memory.

    The method must not take any arguments (i.e. be a nullary function)

    Parameters

    • Optional name: undefined | string

    Returns (Anonymous function)

enterNamespace

  • Get the namespace described by namespace relative to the start namespace.

    Type parameters

    • T

    Parameters

    • start: Namespace<T>
    • namespace: string | string[]

    Returns Namespace<T>

enterParentNamespace

  • enterParentNamespace<T>(start: Namespace<T>, namespace: string | string[]): [Namespace<T>, string]
  • Like enterNamespace but instead of returning the Namespace namespace it returns its parent namespace and the key that would lead to the namespace namespace.

    Type parameters

    • T

    Parameters

    • start: Namespace<T>
    • namespace: string | string[]

    Returns [Namespace<T>, string]

flattenNamespace

  • flattenNamespace<T>(ns: Namespace<T>): object
  • Get an object literal representing the flattened namespace. The namespace is flattened by combining the keys with a period.

    example
    
    const ns = {a: {
         b: {
             c: 5,
             d: 6
         },
         e: 7,
         __value: 8
    }};
    
    const flat = flattenNamespace(ns);
    
    // true
    flat === {
        "a.b.c": 5,
        "a.b.d": 6,
        "a.e": 7,
        "a": 8,
    };

    Type parameters

    • T

    Parameters

    Returns object

    • [key: string]: T

removeElement

  • removeElement(el: Element): void
  • Remove an element but also try to unmount its React component if there is any.

    Parameters

    • el: Element

    Returns void

Object literals

Const NAMESPACE_TRAPS

NAMESPACE_TRAPS: object

Traps passed to the Proxy for Namespace objects.

deleteProperty

  • deleteProperty(target: Namespace, p: PropertyKey): boolean

get

  • get<T>(target: Namespace<T>, p: PropertyKey, receiver?: any): T
  • Type parameters

    • T

    Parameters

    • target: Namespace<T>
    • p: PropertyKey
    • Optional receiver: any

    Returns T

has

  • has(target: Namespace, p: PropertyKey): boolean

ownKeys

set

  • set<T>(target: Namespace<T>, p: PropertyKey, value: T, receiver?: any): boolean
  • Type parameters

    • T

    Parameters

    • target: Namespace<T>
    • p: PropertyKey
    • value: T
    • Optional receiver: any

    Returns boolean

Generated using TypeDoc