Skip to content

Commit

Permalink
fix events#off
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislas Polu committed Apr 17, 2012
1 parent f5805e3 commit 394628a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cell-0.2.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/event.js
Expand Up @@ -104,10 +104,12 @@ CELL.emitter = function(spec, my) {
* @param handler {Function} the handler
*/
off = function(type, handler) {
for(var i = my.handlers[type].length - 1; i >= 0; i--) {
if(handler === my.handlers[type][i])
my.handlers[type].splice(i, 1);
}
if(my.handlers[type]) {
for(var i = my.handlers[type].length - 1; i >= 0; i--) {
if(handler === my.handlers[type][i])
my.handlers[type].splice(i, 1);
}
}
};


Expand Down

0 comments on commit 394628a

Please sign in to comment.