Skip to content

Commit 21fffe9

Browse files
committed
fix: Check for bindings existence when off method is called with no args
close #40
1 parent 113ee1b commit 21fffe9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/off/index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ export default function off(object, givenNames, callback, context) {
3636
def.events = {};
3737

3838
nofn.forOwn(def.props, ({ bindings }, propName) => {
39-
nofn.forEach(bindings, ({ node }) => {
40-
const eventNamespace = def.id + propName;
41-
dom.$(node).off(`.${eventNamespace}`);
42-
});
39+
if(bindings) {
40+
nofn.forEach(bindings, ({ node }) => {
41+
const eventNamespace = def.id + propName;
42+
dom.$(node).off(`.${eventNamespace}`);
43+
});
44+
}
4345
});
4446

4547
return object;

0 commit comments

Comments
 (0)