aboutsummaryrefslogblamecommitdiff
path: root/src/background/repositories/FindRepository.ts
blob: 6a087f55fca08318d77c350aa0cc9e44e412add6 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                      
                                                             

                                        
             
                                     
                               


                                     
                                 

                                                             
                                             
                                              

   
import { injectable } from 'tsyringe';
import MemoryStorage from '../infrastructures/MemoryStorage';

const FIND_KEYWORD_KEY = 'find-keyword';

@injectable()
export default class FindRepository {
  private cache: MemoryStorage;

  constructor() {
    this.cache = new MemoryStorage();
  }

  getKeyword(): Promise<string> {
    return Promise.resolve(this.cache.get(FIND_KEYWORD_KEY));
  }

  setKeyword(keyword: string): Promise<any> {
    this.cache.set(FIND_KEYWORD_KEY, keyword);
    return Promise.resolve();
  }
}