Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.addSignalListener

A modern runtime for JavaScript and TypeScript.
Latest
function Deno.addSignalListener
import { Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { addSignalListener } = Deno;

Registers the given function as a listener of the given signal event.

Deno.addSignalListener(
  "SIGTERM",
  () => {
    console.log("SIGTERM!")
  }
);

Note: On Windows only "SIGINT" (CTRL+C) and "SIGBREAK" (CTRL+Break) are supported.

Parameters

signal: Signal
handler: () => void