Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
optimize unbind
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelw committed Sep 5, 2013
1 parent a482404 commit 8e33d67
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/NodeBind.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@
};

Node.prototype.unbind = function(name) {
this.bindings = this.bindings || {};
if (!this.bindings)
this.bindings = {};
if (!this.bindings[name])
return;
var binding = this.bindings[name];
if (binding && typeof binding.close === 'function')
binding.close();
delete this.bindings[name];
this.bindings[name] = undefined;
};

Node.prototype.unbindAll = function() {
Expand Down

0 comments on commit 8e33d67

Please sign in to comment.