Options
All
  • Public
  • Public/Protected
  • All
Menu

ObjectRegistry represents a structure for storing object lifecycle info. Adding an object to the registry will place it into a category of undeleted until it is remove from the registry. Also the object will be placed into a category of uncollected until it is disposed by garbage collector.

Hierarchy

  • ObjectRegistry

Index

Properties

Protected finalizationRegistry

finalizationRegistry: any = new FinalizationRegistry((id: string) => {this.uncollectedObjectsMap.delete(id);this.onCollect(id);})

uncollectedObjectsMap

uncollectedObjectsMap: Map<string, { isWasmObject: boolean; objectRef: TWeakRef; proxyRef?: TWeakRef; revocableTokenRef?: TWeakRef<ReturnType<ProxyConstructor["revocable"]>> }> = new Map<string, TObjectEntryInfo>()

undeletedObjectsMap

undeletedObjectsMap: Map<string, { isWasmObject: boolean; objectRef: TWeakRef; proxyRef?: TWeakRef; revocableTokenRef?: TWeakRef<ReturnType<ProxyConstructor["revocable"]>> }> = new Map<string, TObjectEntryInfo>()

weakMapRegistry

weakMapRegistry: WeakMap<object, any> = new WeakMap()

Methods

add

  • add(obj: any, id: string, options?: TObjectEntryOptions): void
  • Adds an object and its related info to the registry

    Parameters

    • obj: any
    • id: string
    • Default value options: TObjectEntryOptions = { isWasmObject: false }

    Returns void

Protected deleteEntry

  • deleteEntry(entry: TObjectEntryInfo, key: string): void
  • Calls delete on a specific object within the registry

    Parameters

    • entry: TObjectEntryInfo
    • key: string

    Returns void

deleteIDeletableObjects

  • deleteIDeletableObjects(): void
  • Calls delete on instances of IDeletable objects within the registry

    Returns void

deleteWasmObjects

  • deleteWasmObjects(): void
  • Calls delete on instances of Web Assembly objects within the registry

    Returns void

getObjectId

  • getObjectId(obj: any): any
  • Parameters

    • obj: any

    Returns any

getState

  • getState(): any
  • Returns the state of the registry

    Returns any

log

  • log(): void
  • Outputs the state of registry to the console

    Returns void

Protected onCollect

  • onCollect(id: string): void
  • The callback executed when an object is being garbage collected

    Parameters

    • id: string

    Returns void

remove

  • remove(id: string): boolean
  • Removes the object from the undeleted objects collection

    Parameters

    • id: string

    Returns boolean

Generated using TypeDoc