Skip to main content

Class: TBundle

Defined in: core/bundle.ts:7

Represents a predefined set of components that can be used to create entities

Constructors​

Constructor​

new TBundle(componentTypes, defaultValues?): TBundle

Defined in: core/bundle.ts:8

Parameters​

componentTypes​

TComponentConstructor[]

defaultValues?​

Map<TComponentConstructor, () => TComponent> = ...

Returns​

TBundle

Properties​

componentTypes​

readonly componentTypes: TComponentConstructor[]

Defined in: core/bundle.ts:9

Methods​

createComponents()​

createComponents(): TComponent[]

Defined in: core/bundle.ts:86

Creates the components defined in this bundle without creating an entity

Returns​

TComponent[]


merge()​

merge(other): TBundle

Defined in: core/bundle.ts:56

Merges this bundle with another bundle and returns a new bundle Components from the other bundle will override components of the same type

Parameters​

other​

TBundle

Returns​

TBundle


with()​

with(...overrides): TBundle

Defined in: core/bundle.ts:37

Creates a new bundle with the specified component overrides

Parameters​

overrides​

...TComponent[]

Component instances to override default values in the bundle

Returns​

TBundle


withComponent()​

withComponent<T>(componentType, createDefault?): TBundle

Defined in: core/bundle.ts:19

Adds a component type to this bundle with an optional default value factory

Type Parameters​

T​

T extends TComponent

Parameters​

componentType​

TComponentConstructor<T>

createDefault?​

() => T

Returns​

TBundle


fromComponents()​

static fromComponents(componentTypes): TBundle

Defined in: core/bundle.ts:77

Creates a new bundle from a set of component types

Parameters​

componentTypes​

TComponentConstructor[]

Returns​

TBundle