From 4c43362f17590bc56872dabdad68c64f683a2d93 Mon Sep 17 00:00:00 2001 From: Cooper Benson Date: Thu, 26 Jan 2017 10:04:04 -0700 Subject: [PATCH 1/3] Fixing incorrect type on ROSLIB.Topic.unsubscribe --- roslib/index.d.ts | 4 ++-- roslib/roslib-tests.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/roslib/index.d.ts b/roslib/index.d.ts index c195387901..89ac42ab66 100644 --- a/roslib/index.d.ts +++ b/roslib/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for roslib.js // Project: http://wiki.ros.org/roslibjs -// Definitions by: Stefan Profanter +// Definitions by: Stefan Profanter , Cooper Benson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -340,7 +340,7 @@ declare namespace ROSLIB { * * provided and other listeners are registered the topic won't * * unsubscribe, just stop emitting to the passed listener */ - unsubscribe(callback?:() => void):void; + unsubscribe(callback?:(callback:(message:Message) => void) => void):void; /** * Registers as a publisher for the topic. diff --git a/roslib/roslib-tests.ts b/roslib/roslib-tests.ts index b67578536a..36b505ea12 100644 --- a/roslib/roslib-tests.ts +++ b/roslib/roslib-tests.ts @@ -48,10 +48,13 @@ var listener = new ROSLIB.Topic({ messageType: 'std_msgs/String' }); -listener.subscribe(function (message:any) { - console.log('Received message on ' + listener.name + ': ' + message.data); +let subscription_callback = function (message:ROSLIB.Message) { + console.log('Received message on ' + listener.name + ': ' + message); listener.unsubscribe(); -}); +} + +listener.subscribe(subscription_callback); +listener.unsubscribe(subscription_callback); // Calling a service // ----------------- From 6220df1b86d0b7da583273abd9c4790fd6f1f11d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 7 Feb 2017 14:33:39 -0800 Subject: [PATCH 2/3] Add version --- roslib/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roslib/index.d.ts b/roslib/index.d.ts index 89ac42ab66..1aea8659d3 100644 --- a/roslib/index.d.ts +++ b/roslib/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for roslib.js +// Type definitions for roslib.js 0.18.0 // Project: http://wiki.ros.org/roslibjs // Definitions by: Stefan Profanter , Cooper Benson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From da97c31d8f96f05e2c42caf950a423bbc81f25cb Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 7 Feb 2017 14:37:52 -0800 Subject: [PATCH 3/3] remove newline --- roslib/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/roslib/index.d.ts b/roslib/index.d.ts index 4bba368cf5..368c190bd6 100644 --- a/roslib/index.d.ts +++ b/roslib/index.d.ts @@ -1,5 +1,4 @@ // Type definitions for roslib.js 0.18.0 - // Project: http://wiki.ros.org/roslibjs // Definitions by: Stefan Profanter , Cooper Benson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped