Skip to content

Commit

Permalink
fix: Check for bindings existence when off method is called with no args
Browse files Browse the repository at this point in the history
close #40
  • Loading branch information
finom committed Oct 18, 2016
1 parent 113ee1b commit 21fffe9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/off/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ export default function off(object, givenNames, callback, context) {
def.events = {};

nofn.forOwn(def.props, ({ bindings }, propName) => {
nofn.forEach(bindings, ({ node }) => {
const eventNamespace = def.id + propName;
dom.$(node).off(`.${eventNamespace}`);
});
if(bindings) {
nofn.forEach(bindings, ({ node }) => {
const eventNamespace = def.id + propName;
dom.$(node).off(`.${eventNamespace}`);
});
}
});

return object;
Expand Down

0 comments on commit 21fffe9

Please sign in to comment.