Skip to content

Commit

Permalink
Merge pull request #121 from megawac/topic-events
Browse files Browse the repository at this point in the history
Add unsubscribe and unadvertise events to topic
  • Loading branch information
rctoris committed Oct 23, 2014
2 parents 0f5ca60 + d5bf3c4 commit ede6f68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/Topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Topic.prototype.subscribe = function(callback) {
Topic.prototype.unsubscribe = function() {
if (!this.subscribeId) { return; }
this.ros.off(this.name, this._messageCallback);
this.emit('unsubscribe');
this.ros.callOnConnection({
op: 'unsubscribe',
id: this.subscribeId,
Expand Down Expand Up @@ -115,6 +116,7 @@ Topic.prototype.unadvertise = function() {
if (!this.isAdvertised) {
return;
}
this.emit('unadvertise');
this.ros.callOnConnection({
op: 'unadvertise',
id: this.advertiseId,
Expand Down

0 comments on commit ede6f68

Please sign in to comment.