mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Fixing incorrect type on ROSLIB.Topic.unsubscribe
This commit is contained in:
4
roslib/index.d.ts
vendored
4
roslib/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for roslib.js
|
||||
// Project: http://wiki.ros.org/roslibjs
|
||||
// Definitions by: Stefan Profanter <https://github.com/Pro/>
|
||||
// Definitions by: Stefan Profanter <https://github.com/Pro/>, Cooper Benson <https://github.com/skycoop/>
|
||||
// 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.
|
||||
|
||||
@@ -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
|
||||
// -----------------
|
||||
|
||||
Reference in New Issue
Block a user