From be87a1e86547d5891e4703d8644014fe85265fce Mon Sep 17 00:00:00 2001 From: Minggang Wang Date: Sun, 26 Jan 2025 15:58:00 +0800 Subject: [PATCH] [TypeScript] Add declaration for removeSignalHandlers() This patch adds the declaration for removeSignalHandlers() method into index.d.ts. Fix: #1022 --- test/types/main.ts | 3 +++ types/index.d.ts | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/test/types/main.ts b/test/types/main.ts index da9f32b9..40d3f4ba 100644 --- a/test/types/main.ts +++ b/test/types/main.ts @@ -21,6 +21,9 @@ rclnodejs.isShutdown(); // $ExpectType void rclnodejs.shutdown(); +// $ExpectType void +rclnodejs.removeSignalHandlers(); + // ---- DistroUtil ---- // $ExpectType DistroId diff --git a/types/index.d.ts b/types/index.d.ts index 77987ae1..b0e4dafe 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -144,6 +144,13 @@ declare module 'rclnodejs' { type: T ): MessageType; + /** + * Removes the default signal handler installed by rclnodejs. After calling this, rclnodejs + * will no longer clean itself up when a SIGINT is received, it is the application's + * responsibility to properly shut down all nodes and contexts. + */ + function removeSignalHandlers(): void; + /** * Get a list of action names and types for action clients associated with a node. * @param node - The node used for discovery.