circu.js
    Preparing search index...

    Interface SignalHandler

    Interface representing a signal handler object. Returned by the signal() function to manage a registered signal listener. The handler remains active until explicitly closed.

    interface SignalHandler {
        "[toStringTag]": "Signal Handler";
        signal: string | null;
        close(): void;
    }
    Index

    Properties

    Methods

    Properties

    "[toStringTag]": "Signal Handler"

    Internal tag for object identification. Always returns "Signal Handler".

    signal: string | null

    The name of the signal being handled (e.g., "SIGINT", "SIGTERM"). Returns null if the signal number is not recognized or if the handler is closed.

    const handler = signal(signals.SIGINT, () => { /* ... * / });
    console.log(`Monitoring: ${handler.signal}`); // "SIGINT"

    Methods

    • Closes the signal handler, stopping further signal monitoring. Once closed, the handler cannot be reused and resources are freed.

      Returns void

      const handler = signal(signals.SIGTERM, () => {
      console.log('Shutting down...');
      handler.close();
      });

      // Manually close after 5 seconds if not triggered
      setTimeout(() => {
      if (handler.signal) { // Check if still active
      console.log('Timeout reached, closing handler');
      handler.close();
      }
      }, 5000);