aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-15 20:57:45 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-15 20:57:45 +0900
commitf891ccf9990c7cd28b43ca9824a866771ec91c81 (patch)
tree1350fe8bcfdb47fe6c4840ec63bb40c0e3548dfa /src/background
parente45985088e0bbd041a567bab6b7665d2906528e4 (diff)
parentbae3b9637fd85fd8c81143f4fc273074ec26af7e (diff)
Merge branch 'test'
Diffstat (limited to 'src/background')
-rw-r--r--src/background/key-queue.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/background/key-queue.js b/src/background/key-queue.js
index e21399e..666eec3 100644
--- a/src/background/key-queue.js
+++ b/src/background/key-queue.js
@@ -12,20 +12,20 @@ const DEFAULT_KEYMAP = [
export default class KeyQueue {
- constructor(keymap) {
+ constructor() {
this.data = [];
- this.keymap = keymap;
+ this.keymap = DEFAULT_KEYMAP;
}
push(key) {
this.data.push(key);
- let filtered = DEFAULT_KEYMAP.filter((map) => {
+ let filtered = this.keymap.filter((map) => {
return keys.hasPrefix(map.keys, this.data)
});
if (filtered.length == 0) {
this.data = [];
- return;
+ return null;
} else if (filtered.length == 1) {
let map = filtered[0];
if (map.keys.length == this.data.length) {
@@ -35,4 +35,8 @@ export default class KeyQueue {
}
return null;
}
+
+ queuedKeys() {
+ return this.data;
+ }
}