Skip to main content
Module.InitializeHook - module - Node documentation
type alias Module.InitializeHook

Usage in Deno

import { Module } from "node:module";

The initialize hook provides a way to define a custom function that runs in the hooks thread when the hooks module is initialized. Initialization happens when the hooks module is registered via register.

This hook can receive data from a register invocation, including ports and other transferrable objects. The return value of initialize can be a Promise, in which case it will be awaited before the main application thread execution resumes.

Type Parameters

Data = any

Definition

(data: Data) => void | Promise<void>