Skip to content

hooks

@tsed/hooks

Usage

typescript
import { hooks } from "@tsed/hooks";

See /packages/hooks/src/Hooks.ts.

Overview

ts
const hooks: Hooks;

Description

Global singleton instance of the Hooks class.

This instance provides a centralized event management system that can be used throughout an application without needing to create and pass around separate Hooks instances.

Usage

typescript
import {hooks} from "@tsed/hooks";

hooks.on("app:started", () => {
  console.log("Application started");
});

hooks.emit("app:started", []);

Released under the MIT License.