Skip to content

Commit

Permalink
fix(index): make detection "sourceString" more private
Browse files Browse the repository at this point in the history
renaming "sourceString" to "__sourceString" so it won't conflict

about #7 (comment) #7
  • Loading branch information
tunnckoCore committed Apr 1, 2017
1 parent 26ba638 commit 7d6c4e2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/dush.common.js
Expand Up @@ -140,7 +140,7 @@ function dush () {
}

var fn = once ? func : handler;
fn.sourceString = handler.toString();
fn.__sourceString = handler.toString();

e.push(fn);
return app
Expand Down Expand Up @@ -221,7 +221,7 @@ function dush () {
off: function off (name, handler) {
if (handler && app._allEvents[name]) {
var fnStr = handler.toString();
app._allEvents[name] = app._allEvents[name].filter(function (func) { return func.sourceString !== fnStr; });
app._allEvents[name] = app._allEvents[name].filter(function (func) { return func.__sourceString !== fnStr; });
} else if (name) {
app._allEvents[name] = [];
} else {
Expand Down
4 changes: 2 additions & 2 deletions dist/dush.es.js
Expand Up @@ -138,7 +138,7 @@ function dush () {
}

var fn = once ? func : handler;
fn.sourceString = handler.toString();
fn.__sourceString = handler.toString();

e.push(fn);
return app
Expand Down Expand Up @@ -219,7 +219,7 @@ function dush () {
off: function off (name, handler) {
if (handler && app._allEvents[name]) {
var fnStr = handler.toString();
app._allEvents[name] = app._allEvents[name].filter(function (func) { return func.sourceString !== fnStr; });
app._allEvents[name] = app._allEvents[name].filter(function (func) { return func.__sourceString !== fnStr; });
} else if (name) {
app._allEvents[name] = [];
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/dush.umd.js

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

Binary file modified dist/dush.umd.js.gz
Binary file not shown.

0 comments on commit 7d6c4e2

Please sign in to comment.