# Class: PoolAllocator
An allocator, which implements object pooling for entities and components.
# Table of contents
# Constructors
# Methods
# Constructors
# constructor
• new PoolAllocator(config?
)
Create a new pool allocator.
# Parameters
Name | Type | Description |
---|---|---|
config? | PoolAllocatorConfig | The configuration to use. |
# Defined in
src/pooling/PoolAllocator.ts:31 (opens new window)
# Methods
# freeComponent
▸ freeComponent(component
): void
Free a component.
# Parameters
Name | Type | Description |
---|---|---|
component | Component | The component to free. |
# Returns
void
# Defined in
src/pooling/PoolAllocator.ts:73 (opens new window)
# freeEntity
▸ freeEntity(entity
): void
Free an entity.
# Parameters
Name | Type | Description |
---|---|---|
entity | Entity | The entity to free. |
# Returns
void
# Defined in
src/pooling/PoolAllocator.ts:50 (opens new window)
# obtainComponent
▸ obtainComponent<T
>(Class
): T
# Type parameters
Name | Type | Description |
---|---|---|
T | extends Component <T > | The type of component, do not specify manually! |
# Parameters
Name | Type | Description |
---|---|---|
Class | NoArgsComponentConstructor <T > | The constructor of the component. |
# Returns
T
A new or reused component.
# Defined in
src/pooling/PoolAllocator.ts:59 (opens new window)
# obtainEntity
▸ obtainEntity(): Entity
# Returns
A new or reused entity.
# Defined in
← Pool ReadonlyBits →