ResourcePool
sourceManages retention of pooled resources.
Constructors
new ResourcePool<T extends Disposable>(instanceConstructor: Function): ResourcePoolsource
Properties
instanceConstructor: Functionsource
instanceMap: Map<StringHash, ControlBlock<T>>source
Methods
Static methods
collect(): voidsource
forType<T extends Function>(type: T): ResourcePoolsource
Gets the resource pool for a given type.
getPersistent<T extends Function>(type: T, args: ConstructorParameters<T>): Handlesource
Gets a persistent Handle to a resource. Pass the constructor arguments for that resource. If an existing instance exists that matches those arguments, a new handle is returned that points to that instance; if no such instance exists, one is constructed.
getTemporary<T extends Function>(type: T, args: ConstructorParameters<T>): InstanceType<T>source
Gets a reference to a resource. Pass the constructor arguments for that resource. If an existing instance exists that matches those arguments, a new handle is returned that points to that instance; if no such instance exists, one is constructed. Use this if the reference does not need to be retained.
Instance methods
getOrInstantiate(args: any[]): ControlBlock<T>source
getPersistent(args: any[]): Handlesource
getTemporary(args: any[]): Tsource