Skip to content

Commit

Permalink
Improving dom/emitter/on/*
Browse files Browse the repository at this point in the history
  • Loading branch information
Lcfvs committed May 9, 2018
1 parent 0a8c2d3 commit e124f2c
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion dom/emitter/.matches.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { indexOf } from '../../primitive/array/indexOf'

export function matches (event, ctrl, shift, keys, code) {
export function matches (event, ctrl, alt, shift, keys, code) {
return event.ctrlKey === ctrl &&
event.altKey === alt &&
event.shiftKey === shift &&
(indexOf(keys, event.key) > 1 ||
event.which === code ||
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onBack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onBack (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, false, ['Backspace'], 8)) {
if (matches(event, false, false, false, ['Backspace'], 8)) {
return listener.call(this, event)
}
}, useCapture)
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onDelete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onDelete (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, false, ['Delete', 'Del'], 46)) {
if (matches(event, false, false, false, ['Delete', 'Del'], 46)) {
return listener.call(this, event)
}
}, useCapture)
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onDown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onDown (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, false, ['ArrowDown', 'Down'], 47)) {
if (matches(event, false, false, false, ['ArrowDown', 'Down'], 47)) {
return listener.call(this, event)
}
}, useCapture)
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onEnter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onEnter (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, false, ['Enter'], 13)) {
if (matches(event, false, false, false, ['Enter'], 13)) {
return listener.call(this, event)
}
}, useCapture)
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onShiftEnter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onShiftEnter (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, true, ['Enter'], 13)) {
if (matches(event, false, false, true, ['Enter'], 13)) {
return listener.call(this, event)
}
}, useCapture)
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onSpace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onSpace (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, false, [' ', 'Spacebar'], 32)) {
if (matches(event, false, false, false, [' ', 'Spacebar'], 32)) {
return listener.call(this, event)
}
}, useCapture)
Expand Down
2 changes: 1 addition & 1 deletion dom/emitter/on/onUp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matches } from '../../.matches'

export function onUp (element, listener, useCapture) {
return on('keydown', element, function (event) {
if (matches(event, false, false, ['ArrowUp', 'Up'], 39)) {
if (matches(event, false, false, fase, false, ['ArrowUp', 'Up'], 39)) {
return listener.call(this, event)
}
}, useCapture)
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": "anticore",
"version": "2.16.0",
"version": "2.17.0",
"description": "A generic living DOM library to simplify your client code, like with its easiest middleware manager for AJAX requests.",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit e124f2c

Please sign in to comment.