Comparing version 1.0.2-alpha to 1.0.3-alpha
@@ -26,3 +26,3 @@ import { Join, SubArray, MutableTuple } from "just-types"; | ||
export type EncodedSequence = number; | ||
export type Callback = () => any; | ||
export type Callback = (event?: KeyboardEvent) => any; | ||
export type KeyboardEventListener = (event: KeyboardEvent) => any; | ||
@@ -42,3 +42,3 @@ export type HandlerState<KA extends KeyAliases = {}> = { | ||
remove(keys: Array<StringKey<KA>>, fn: Callback): this; | ||
handle(event: KeyboardEvent): this; | ||
handle(event: KeyboardEvent): boolean; | ||
} | ||
@@ -50,5 +50,3 @@ declare class Handler<Aliases extends KeyAliases> implements HandlerInterface<Aliases> { | ||
remove(keys: StringKey<Aliases> | Array<StringKey<Aliases>>, fn: Callback): this; | ||
addListener(target: EventTarget): this; | ||
removeListener(target: EventTarget): this; | ||
handle(event: KeyboardEvent): this; | ||
handle(event: KeyboardEvent): boolean; | ||
} | ||
@@ -55,0 +53,0 @@ type DefaultAliases = typeof aliases; |
@@ -506,4 +506,11 @@ function $parcel$export(e, n, v, s) { | ||
if (state.history.length > state.historySize) state.history.shift(); | ||
for (const sequenceCode of $b0dd6840dedf4baf$export$ea75b4e9c5008d0c(state.history))for (const fn of state.bindings.get(sequenceCode) || [])fn(); | ||
return state; | ||
let foundMatchingSequence = false; | ||
for (const sequenceCode of $b0dd6840dedf4baf$export$ea75b4e9c5008d0c(state.history))for (const fn of state.bindings.get(sequenceCode) || []){ | ||
foundMatchingSequence = true; | ||
fn(event); | ||
} | ||
return [ | ||
state, | ||
foundMatchingSequence | ||
]; | ||
} | ||
@@ -515,12 +522,2 @@ function $b32bc79731ce4566$export$3b88b12a1b2479e8(state) { | ||
} | ||
function $b32bc79731ce4566$export$9dd68fe78f37278b(state, target, handle) { | ||
target.addEventListener('keyup', handle); | ||
state.targets.add(target); | ||
return state; | ||
} | ||
function $b32bc79731ce4566$export$20ae7ec87f7f8696(state, target, handle) { | ||
target.removeEventListener('keyup', handle); | ||
state.targets.delete(target); | ||
return state; | ||
} | ||
@@ -543,13 +540,6 @@ | ||
} | ||
addListener(target) { | ||
this.state = $b32bc79731ce4566$export$9dd68fe78f37278b(this.state, target, this.handle); | ||
return this; | ||
} | ||
removeListener(target1) { | ||
this.state = $b32bc79731ce4566$export$20ae7ec87f7f8696(this.state, target1, this.handle); | ||
return this; | ||
} | ||
handle(event) { | ||
this.state = $b32bc79731ce4566$export$d6e5ca10785815df(this.state, event); | ||
return this; | ||
const [state, foundMatchingSequence] = $b32bc79731ce4566$export$d6e5ca10785815df(this.state, event); | ||
this.state = state; | ||
return foundMatchingSequence; | ||
} | ||
@@ -560,4 +550,2 @@ constructor(state){ | ||
this.remove = this.remove.bind(this); | ||
this.addListener = this.addListener.bind(this); | ||
this.removeListener = this.removeListener.bind(this); | ||
this.handle = this.handle.bind(this); | ||
@@ -564,0 +552,0 @@ } |
@@ -485,4 +485,11 @@ var $b289af7168eb38ef$exports = {}; | ||
if (state.history.length > state.historySize) state.history.shift(); | ||
for (const sequenceCode of $43bfee6ae65bc01f$export$ea75b4e9c5008d0c(state.history))for (const fn of state.bindings.get(sequenceCode) || [])fn(); | ||
return state; | ||
let foundMatchingSequence = false; | ||
for (const sequenceCode of $43bfee6ae65bc01f$export$ea75b4e9c5008d0c(state.history))for (const fn of state.bindings.get(sequenceCode) || []){ | ||
foundMatchingSequence = true; | ||
fn(event); | ||
} | ||
return [ | ||
state, | ||
foundMatchingSequence | ||
]; | ||
} | ||
@@ -494,12 +501,2 @@ function $7ce5330ea363ecfa$export$3b88b12a1b2479e8(state) { | ||
} | ||
function $7ce5330ea363ecfa$export$9dd68fe78f37278b(state, target, handle) { | ||
target.addEventListener('keyup', handle); | ||
state.targets.add(target); | ||
return state; | ||
} | ||
function $7ce5330ea363ecfa$export$20ae7ec87f7f8696(state, target, handle) { | ||
target.removeEventListener('keyup', handle); | ||
state.targets.delete(target); | ||
return state; | ||
} | ||
@@ -522,13 +519,6 @@ | ||
} | ||
addListener(target) { | ||
this.state = $7ce5330ea363ecfa$export$9dd68fe78f37278b(this.state, target, this.handle); | ||
return this; | ||
} | ||
removeListener(target1) { | ||
this.state = $7ce5330ea363ecfa$export$20ae7ec87f7f8696(this.state, target1, this.handle); | ||
return this; | ||
} | ||
handle(event) { | ||
this.state = $7ce5330ea363ecfa$export$d6e5ca10785815df(this.state, event); | ||
return this; | ||
const [state, foundMatchingSequence] = $7ce5330ea363ecfa$export$d6e5ca10785815df(this.state, event); | ||
this.state = state; | ||
return foundMatchingSequence; | ||
} | ||
@@ -539,4 +529,2 @@ constructor(state){ | ||
this.remove = this.remove.bind(this); | ||
this.addListener = this.addListener.bind(this); | ||
this.removeListener = this.removeListener.bind(this); | ||
this.handle = this.handle.bind(this); | ||
@@ -543,0 +531,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.2-alpha", | ||
"version": "1.0.3-alpha", | ||
"source": "src/index.ts", | ||
@@ -23,2 +23,5 @@ "main": "dist/index.js", | ||
}, | ||
"dependencies": { | ||
"just-types": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
@@ -31,3 +34,2 @@ "@parcel/packager-ts": "^2.0.1", | ||
"jest": "^27.3.1", | ||
"just-types": "^1.1.0", | ||
"parcel": "^2.0.1", | ||
@@ -34,0 +36,0 @@ "ts-jest": "^27.0.7", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
10
88374
1
1134
+ Addedjust-types@^1.1.0
+ Addedjust-types@1.6.0(transitive)