aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-26 16:24:14 +0900
committerGitHub <noreply@github.com>2019-05-26 16:24:14 +0900
commitcd584c8e243bafa8fc284279f716e8113607cd65 (patch)
treebc39bc30369f149e4ba4b6dc9c353b2906c4ef90 /src/background/repositories
parent07897df636ca3e732490d53fd2acf947738bf16e (diff)
parent34a96cdc9c5d7c8a11c6f1ae512fbc97724f61c4 (diff)
Merge pull request #592 from ueokande/repeat-last-operation
Add "repeat last operation" command
Diffstat (limited to 'src/background/repositories')
-rw-r--r--src/background/repositories/RepeatRepository.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/background/repositories/RepeatRepository.ts b/src/background/repositories/RepeatRepository.ts
new file mode 100644
index 0000000..c7f7a71
--- /dev/null
+++ b/src/background/repositories/RepeatRepository.ts
@@ -0,0 +1,22 @@
+import { injectable } from 'tsyringe';
+import { Operation } from '../../shared/operations';
+import MemoryStorage from '../infrastructures/MemoryStorage';
+
+const REPEAT_KEY = 'repeat';
+
+@injectable()
+export default class RepeatRepository {
+ private cache: MemoryStorage;
+
+ constructor() {
+ this.cache = new MemoryStorage();
+ }
+
+ getLastOperation(): Operation | undefined {
+ return this.cache.get(REPEAT_KEY);
+ }
+
+ setLastOperation(op: Operation): void {
+ this.cache.set(REPEAT_KEY, op);
+ }
+}