Skip to content

Commit

Permalink
feat(context): context of listener is now the listener
Browse files Browse the repository at this point in the history
so now you can bind context to your listeners using .bind for example; otherwise "this" in the
listener will be function (itself)
  • Loading branch information
tunnckoCore committed Mar 19, 2017
1 parent fec33b9 commit 923391d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
6 changes: 3 additions & 3 deletions dist/dush.common.js
Expand Up @@ -129,7 +129,7 @@ function dush () {
function func () {
if (!func.called) {
app.off(name, func);
handler.apply(undefined, arguments);
handler.apply(handler, arguments);
func.called = true;
}
}
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(undefined, args.slice(1)); });
(all['*'] || []).map(function (handler) { handler.apply(undefined, args); });
(all[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(all['*'] || []).map(function (handler) { handler.apply(handler, args); });
}

return app
Expand Down
6 changes: 3 additions & 3 deletions dist/dush.es.js
Expand Up @@ -127,7 +127,7 @@ function dush () {
function func () {
if (!func.called) {
app.off(name, func);
handler.apply(undefined, arguments);
handler.apply(handler, arguments);
func.called = true;
}
}
Expand Down Expand Up @@ -258,8 +258,8 @@ function dush () {
emit: function emit (name) {
if (name !== '*') {
var args = [].slice.call(arguments);
(all[name] || []).map(function (handler) { handler.apply(undefined, args.slice(1)); });
(all['*'] || []).map(function (handler) { handler.apply(undefined, args); });
(all[name] || []).map(function (handler) { handler.apply(handler, args.slice(1)); });
(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.
2 changes: 1 addition & 1 deletion dist/dush.umd.js.map

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

0 comments on commit 923391d

Please sign in to comment.