File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ITabsRepository } from "./tabs-repository-interface" ;
2+ import { TabsRepository } from "./tabs-repository" ;
3+
4+ export async function injectTabsRepository ( ) : Promise < ITabsRepository > {
5+ return await TabsRepository . Create ( ) ;
6+ }
Original file line number Diff line number Diff line change 1+ import { Tab } from "../storage/tab" ;
2+ import Browser from 'webextension-polyfill' ;
3+
4+ export interface ITabsRepository {
5+ getTab ( domain :string ) : Promise < Tab > ;
6+ addTab ( value :Browser . Tabs . Tab ) : Promise < void > ;
7+ }
Original file line number Diff line number Diff line change 1+ import { ITabsRepository } from "./tabs-repository-interface" ;
2+ import { Tab } from "../storage/tab" ;
3+ import Browser from 'webextension-polyfill' ;
4+ import { injecStorage } from "../storage/inject-storage" ;
5+
6+ export class TabsRepository implements ITabsRepository {
7+ static tabs : Tab [ ] ;
8+
9+ constructor ( ) { }
10+
11+ static async Create ( ) : Promise < TabsRepository > {
12+ const instance = new TabsRepository ( ) ;
13+ this . tabs = await injecStorage ( ) . getTabs ( ) ;
14+ return instance ;
15+ }
16+
17+ getTab ( domain : string ) : Promise < Tab > {
18+ throw new Error ( "Method not implemented." ) ;
19+ }
20+
21+ addTab ( value : Browser . Tabs . Tab ) : Promise < void > {
22+ throw new Error ( "Method not implemented." ) ;
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments