Skip to content

Commit

Permalink
fix lint complaints about vars used before declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
nbubna committed Mar 28, 2017
1 parent e523f72 commit 739431c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/core.js
@@ -1,3 +1,5 @@
var _;

function Eventi(text){
if (typeof text === "string") {
return _.create.apply(_, arguments);
Expand All @@ -12,7 +14,7 @@ Eventi.fy = function fy(o) {
return o;
};

var _ = Eventi._ = {
_ = Eventi._ = {
version: "<%= pkg.version %>",
global: new Function('return this')(),
noop: function(){},
Expand Down
1 change: 1 addition & 0 deletions src/fire.js
Expand Up @@ -18,6 +18,7 @@ _.fireAll = function(target, events, props) {
}
return event;
};
var _key;// set in on.js
_.dispatch = function(target, event, objectBubbling) {
if (event.global){ target = _.global; }
(target.dispatchEvent || target[_key] || _.noop).call(target, event);
Expand Down
3 changes: 2 additions & 1 deletion src/on.js
Expand Up @@ -46,7 +46,8 @@ _.handlers = function(target, type) {
};
_.capture = ['focus','blur'];

var _key = _._key = '_eventi'+Date.now();
// declared in fire.js
_key = _._key = '_eventi'+Date.now();
_.listener = function(target) {
var listener = target[_key];
if (!listener) {
Expand Down
3 changes: 2 additions & 1 deletion test/off.js
Expand Up @@ -167,6 +167,7 @@
test('off:cleaned event', function() {
expect(4);
var target = {},
handler,
type = 'offevent',
fn = function(e, h) {
if (h.event.type === type) {
Expand All @@ -176,7 +177,7 @@
}
};
Eventi.on(target, type, function(){});
var handler = target[_._key].s[type][0];
handler = target[_._key].s[type][0];
ok(handler, 'should be able to snag ref to handler');
Eventi.on(_, 'off:cleaned', fn)
.off(target, type)
Expand Down

0 comments on commit 739431c

Please sign in to comment.