Skip to content

Commit

Permalink
fix(app.all): tweaks, ensure refereces
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Mar 19, 2017
1 parent 095140f commit 36e4c9e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions dist/dush.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ function dush () {
*/

off: function off (name, handler) {
if (handler && all[name]) {
if (handler && app.all[name]) {
var fnStr = handler.toString();
all[name] = all[name].filter(function (func) { return func.sourceString !== fnStr; });
app.all[name] = app.all[name].filter(function (func) { return func.sourceString !== fnStr; });
} else if (name) {
all[name] = [];
app.all[name] = [];
} else {
app.all = Object.create(null);
}
Expand Down Expand Up @@ -262,8 +262,8 @@ function dush () {
emit: function emit (name) {
if (name !== '*') {
var args = [].slice.call(arguments);
(all[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(all['*'] || []).map(function (handler) { handler.apply(handler, args); });
(app.all[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(app.all['*'] || []).map(function (handler) { handler.apply(handler, args); });
}

return app
Expand Down
10 changes: 5 additions & 5 deletions dist/dush.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ function dush () {
*/

off: function off (name, handler) {
if (handler && all[name]) {
if (handler && app.all[name]) {
var fnStr = handler.toString();
all[name] = all[name].filter(function (func) { return func.sourceString !== fnStr; });
app.all[name] = app.all[name].filter(function (func) { return func.sourceString !== fnStr; });
} else if (name) {
all[name] = [];
app.all[name] = [];
} else {
app.all = Object.create(null);
}
Expand Down Expand Up @@ -260,8 +260,8 @@ function dush () {
emit: function emit (name) {
if (name !== '*') {
var args = [].slice.call(arguments);
(all[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(all['*'] || []).map(function (handler) { handler.apply(handler, args); });
(app.all[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(app.all['*'] || []).map(function (handler) { handler.apply(handler, args); });
}

return app
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.
Loading

0 comments on commit 36e4c9e

Please sign in to comment.