File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed
Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ export * from "./world";
44export * from "./archetype" ;
55export * from "./query" ;
66export * from "./system" ;
7+ export * from "./types" ;
Original file line number Diff line number Diff line change 11import type { EntityId , WildcardRelationId } from "./entity" ;
22
3+ /**
4+ * Hook types for component lifecycle events
5+ */
6+ export interface LifecycleHook < T = unknown > {
7+ /**
8+ * Called when a component is added to an entity
9+ */
10+ onAdded ?: ( entityId : EntityId , componentType : EntityId < T > , component : T ) => void ;
11+ /**
12+ * Called when a component is removed from an entity
13+ */
14+ onRemoved ?: ( entityId : EntityId , componentType : EntityId < T > ) => void ;
15+ }
16+
317/**
418 * Type helper for component tuples extracted from EntityId array
519 */
Original file line number Diff line number Diff line change @@ -4,24 +4,10 @@ import type { EntityId } from "./entity";
44import { EntityIdManager , getDetailedIdType } from "./entity" ;
55import { Query } from "./query" ;
66import type { QueryFilter } from "./query-filter" ;
7- import type { ComponentTuple } from "./types" ;
7+ import type { ComponentTuple , LifecycleHook } from "./types" ;
88import type { System } from "./system" ;
99import { getOrCreateWithSideEffect } from "./utils" ;
1010
11- /**
12- * Hook types for component lifecycle events
13- */
14- export interface LifecycleHook < T = unknown > {
15- /**
16- * Called when a component is added to an entity
17- */
18- onAdded ?: ( entityId : EntityId , componentType : EntityId < T > , component : T ) => void ;
19- /**
20- * Called when a component is removed from an entity
21- */
22- onRemoved ?: ( entityId : EntityId , componentType : EntityId < T > ) => void ;
23- }
24-
2511/**
2612 * World class for ECS architecture
2713 * Manages entities, components, and systems
You can’t perform that action at this time.
0 commit comments