Keymaps as a clean architecture [WIP]
This commit is contained in:
parent
a88324acd9
commit
efc48dc742
15 changed files with 620 additions and 88 deletions
23
src/content/repositories/KeymapRepository.ts
Normal file
23
src/content/repositories/KeymapRepository.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Key } from '../../shared/utils/keys';
|
||||
|
||||
export default interface KeymapRepository {
|
||||
enqueueKey(key: Key): Key[];
|
||||
|
||||
clear(): void;
|
||||
|
||||
// eslint-disable-next-line semi
|
||||
}
|
||||
|
||||
let current: Key[] = [];
|
||||
|
||||
export class KeymapRepositoryImpl {
|
||||
|
||||
enqueueKey(key: Key): Key[] {
|
||||
current.push(key);
|
||||
return current;
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
current = [];
|
||||
}
|
||||
}
|
Reference in a new issue