Repeat last operation
This commit is contained in:
parent
03370301a7
commit
ccbe08cf66
7 changed files with 110 additions and 7 deletions
22
src/background/repositories/RepeatRepository.ts
Normal file
22
src/background/repositories/RepeatRepository.ts
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
Reference in a new issue