Skip to content

defineHookType beta ​

Function of @v12-engine/engine

ts
export declare function defineHookType<T>(def: {
    id: string;
}): HookKey<T>;

A hook of a game's own: const lifeLost = defineHookType<{ invader: Entity; lives: number } & Cancellable>({ id: 'td.lifeLost' }). The game runs it where the moment is (world.hooks.run(lifeLost, { ... })) and reads back what the handlers made of the event; handlers are written with defineHook({ hook: lifeLost, ... }), by the game or by a mod on it. Ids are shared by every game: give them a prefix of the game's