Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResourceManager<T, U>

Type parameters

Hierarchy

  • ResourceManager

Implements

Implemented by

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new ResourceManager<T, U>(instanceConstructor: (options: U) => T): ResourceManager<T, U>

Properties

Private _instances

_instances: T[] = []

Current instances.

Accessors

instances

  • get instances(): T[]

Methods

close

  • close(): void

keepOnly

  • keepOnly(idsToKeep: string[]): T[]
  • Closes and removes the instance if not in idsToKeep.

    Parameters

    • idsToKeep: string[]

      array with ids to keep E.g. ["1234", "4321"]

    Returns T[]

upsert

  • upsert(options: U): T
  • Update instance with new information If there is an instance with the instanceIndentifier equal to options.instanceIndentifier, the update method will be called with instanceOptions. E.g. instance.update(options.instanceOptions) or create new instance with constructor.

    Parameters

    • options: U

      Object with new informations

    Returns T

    return the instance updated/created

Generated using TypeDoc