Skip to content
This repository has been archived by the owner on Sep 27, 2018. It is now read-only.

Commit

Permalink
0.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
4nderss committed May 3, 2016
1 parent 05ecbfb commit 3661e23
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 50 deletions.
20 changes: 13 additions & 7 deletions dist/amd/akp-event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,17 @@ define(['exports', 'aurelia-framework', 'aurelia-pal', './akp-configuration', 'm
if (triggerContext) {
var mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function (e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
} else {
(function () {
Expand All @@ -114,14 +118,16 @@ define(['exports', 'aurelia-framework', 'aurelia-pal', './akp-configuration', 'm
if (!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
})();
}
Expand Down
21 changes: 14 additions & 7 deletions dist/aurelia-keyboard-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,18 @@ export class AKPEventHandler {
//only trigger inside context
let mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function(e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({args: e});
if(res !== undefined && typeof res === 'boolean') {
if(!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;

});
} else {
this.registeredKeys.push(new KeyEvent(key, callback, preventDefault));
Expand All @@ -91,14 +96,16 @@ export class AKPEventHandler {
if(!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({args: e});
if(res !== undefined && typeof res === 'boolean') {
if(!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
}
}
Expand Down
20 changes: 13 additions & 7 deletions dist/commonjs/akp-event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,17 @@ var AKPEventHandler = exports.AKPEventHandler = (_dec = (0, _aureliaFramework.in
if (triggerContext) {
var mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function (e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
} else {
(function () {
Expand All @@ -102,14 +106,16 @@ var AKPEventHandler = exports.AKPEventHandler = (_dec = (0, _aureliaFramework.in
if (!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
})();
}
Expand Down
20 changes: 13 additions & 7 deletions dist/es2015/akp-event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ export let AKPEventHandler = (_dec = inject(DOM, AKPConfiguration), _dec(_class
if (triggerContext) {
let mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function (e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
} else {
this.registeredKeys.push(new KeyEvent(key, callback, preventDefault));
Expand All @@ -78,14 +82,16 @@ export let AKPEventHandler = (_dec = inject(DOM, AKPConfiguration), _dec(_class
if (!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
}
}
Expand Down
20 changes: 13 additions & 7 deletions dist/system/akp-event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ System.register(['aurelia-framework', 'aurelia-pal', './akp-configuration', 'mou
if (triggerContext) {
var mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function (e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
} else {
(function () {
Expand All @@ -101,14 +105,16 @@ System.register(['aurelia-framework', 'aurelia-pal', './akp-configuration', 'mou
if (!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
})();
}
Expand Down
20 changes: 13 additions & 7 deletions dist/temp/aurelia-keyboard-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,17 @@ var AKPEventHandler = exports.AKPEventHandler = (_dec = (0, _aureliaFramework.in
if (triggerContext) {
var mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function (e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
} else {
(function () {
Expand All @@ -116,14 +120,16 @@ var AKPEventHandler = exports.AKPEventHandler = (_dec = (0, _aureliaFramework.in
if (!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({ args: e });
if (res !== undefined && typeof res === 'boolean') {
if (!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
})();
}
Expand Down
3 changes: 3 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 0.3.13 (2016-05-03)
** Added support to return true if you want to not preventDefault() and bubble on.

### 0.3.12 (2016-05-03)
** Cleanup
** Added new attribute keyblock, prevents all keybinds added above the block in the dom structure.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-keyboard-plugin",
"version": "0.3.12",
"version": "0.3.13",
"description": "A keyboard plugin for Aurelia",
"keywords": [
"aurelia",
Expand Down
21 changes: 14 additions & 7 deletions src/akp-event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,18 @@ export class AKPEventHandler {
//only trigger inside context
let mouseTrap = new Mousetrap(triggerContext);
mouseTrap.bind(key, function(e) {
if (preventDefault) {
e.preventDefault();
}

var res = callback({args: e});
if(res !== undefined && typeof res === 'boolean') {
if(!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;

});
} else {
this.registeredKeys.push(new KeyEvent(key, callback, preventDefault));
Expand All @@ -79,14 +84,16 @@ export class AKPEventHandler {
if(!self.checkBlocks(context)) {
return false;
}

if (preventDefault) {
e.preventDefault();
}
var res = callback({args: e});
if(res !== undefined && typeof res === 'boolean') {
if(!res && preventDefault) {
e.preventDefault();
}
return res;
} else if (preventDefault) {
e.preventDefault();
}
return true;
});
}
}
Expand Down

0 comments on commit 3661e23

Please sign in to comment.