registerModule()
function registerModule(config: ModuleConfig): Module;Defined in: src/lib/module/index.ts:291
Register a module with its services and lifecycle hooks.
Returns a Module object that should be the default export of the module file. The runtime imports these modules and manages their lifecycle.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | ModuleConfig | Module configuration including services and lifecycle hooks. |
Returns
Module handle to export from the module file.
Example
// modules/my-feature/module.ts
import { registerModule } from "@core/module";
import { MyService } from "@modules/my-feature/my.service";
export default registerModule({
name: "my-feature",
dependencies: ["characters"],
services: [MyService],
huds: [
{
panel: () => import("@modules/my-feature/huds/my-hud/Panel").then(m => m.default),
hudPosition: "bottom-left",
},
],
onStart: () => console.log("Started"),
onStop: () => console.log("Stopped"),
});