GarbageCollector
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
options: GarbageCollectorOptions
Returns GarbageCollector
Properties
publicoptions
Methods
addCollectableResource
Parameters
type: string
resource: any
Returns void
publiccollectStaleResources
Runs the collection loop to cleanup any stale resources given the registered collect handlers
Parameters
optionaldeadline: IdleDeadline
Returns void
publicforceCollectAll
Force collect all resources, useful for shutting down a game or if you know that you will not use anything you've allocated before now
Returns void
registerCollector
Parameters
type: string
Resource type
timeoutInterval: number
If resource type exceeds interval in milliseconds collect() is called
collect: (resource: any) => boolean
Collection implementation, returns true if collected
Returns void
start
Starts the garbage collection loop
Returns void
stop
Stops the garbage collection loop
Returns void
touch
Update the resource last used timestamp preventing collection
Parameters
resource: any
Returns void
Add a resource to be tracked for collection