mirror of
https://github.com/Ukendio/jecs.git
synced 2026-02-04 15:15:21 +00:00
Add deleted flag to removed handler typings (#288)
* update types * change "StatefulHook" to "HookWithData" and "StatelessHook" to "HookWithDeleted" * Update deleted flag type
This commit is contained in:
parent
fbc4f0f3aa
commit
df454c75a3
1 changed files with 10 additions and 10 deletions
20
src/jecs.d.ts
vendored
20
src/jecs.d.ts
vendored
|
|
@ -172,8 +172,8 @@ export class World {
|
|||
* @param hook The hook to install.
|
||||
* @param value The hook callback.
|
||||
*/
|
||||
set<T>(component: Entity<T>, hook: StatefulHook, value: (e: Entity, id: Id<T>, data: T) => void): void;
|
||||
set<T>(component: Entity<T>, hook: StatelessHook, value: (e: Entity, id: Id<T>) => void): void;
|
||||
set<T>(component: Entity<T>, hook: HookWithData, value: (e: Entity, id: Id<T>, data: T) => void): void;
|
||||
set<T>(component: Entity<T>, hook: HookWithDeleted, value: (e: Entity, id: Id<T>, deleted?: true) => void): void;
|
||||
/**
|
||||
* Assigns a value to a component on the given entity.
|
||||
* @param entity The target entity.
|
||||
|
|
@ -277,7 +277,7 @@ export class World {
|
|||
|
||||
added<T>(component: Entity<T>, listener: (e: Entity, id: Id<T>, value: T) => void): () => void;
|
||||
changed<T>(component: Entity<T>, listener: (e: Entity, id: Id<T>, value: T) => void): () => void;
|
||||
removed<T>(component: Entity<T>, listener: (e: Entity, id: Id<T>) => void): () => void;
|
||||
removed<T>(component: Entity<T>, listener: (e: Entity, id: Id<T>, deleted?: true) => void): () => void;
|
||||
}
|
||||
|
||||
export function world(): World;
|
||||
|
|
@ -323,16 +323,16 @@ export function pair_second<P, O>(world: World, p: Pair<P, O>): Entity<O>;
|
|||
export function ECS_PAIR_FIRST(pair: Pair): number;
|
||||
export function ECS_PAIR_SECOND(pair: Pair): number;
|
||||
|
||||
type StatefulHook = Entity<<T>(e: Entity<T>, id: Id<T>, data: T) => void> & {
|
||||
readonly __nominal_StatefulHook: unique symbol;
|
||||
type HookWithData = Entity<<T>(e: Entity<T>, id: Id<T>, data: T) => void> & {
|
||||
readonly __nominal_HookWithData: unique symbol;
|
||||
};
|
||||
type StatelessHook = Entity<<T>(e: Entity<T>, id: Id<T>) => void> & {
|
||||
readonly __nominal_StatelessHook: unique symbol;
|
||||
type HookWithDeleted = Entity<<T>(e: Entity<T>, id: Id<T>, deleted?: true) => void> & {
|
||||
readonly __nominal_HookWithDeleted: unique symbol;
|
||||
};
|
||||
|
||||
export declare const OnAdd: StatefulHook;
|
||||
export declare const OnRemove: StatelessHook;
|
||||
export declare const OnChange: StatefulHook;
|
||||
export declare const OnAdd: HookWithData;
|
||||
export declare const OnRemove: HookWithDeleted;
|
||||
export declare const OnChange: HookWithData;
|
||||
export declare const ChildOf: Tag;
|
||||
export declare const Component: Tag;
|
||||
export declare const Wildcard: Entity;
|
||||
|
|
|
|||
Loading…
Reference in a new issue