forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.d.ts
More file actions
35 lines (33 loc) · 940 Bytes
/
types.d.ts
File metadata and controls
35 lines (33 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Migrate data among storages (chrome.storage.local / IndexedDB)
*
* @since 4.0.0
*/
export interface StorageMigratable<AllData> {
/**
* Migrate data to target storage
*
* NOTE: MUST NOT change the inner storage type
*
* @param type the type of target storage
*/
migrateStorage(type: timer.option.StorageType): Promise<AllData>
/**
* Handler after migration finished. Clean the old data here
*
* @param allData
*/
afterStorageMigrated(allData: AllData): Promise<void>
}
export type BrowserMigratableNamespace = keyof Omit<timer.backup.ExportData, '__meta__'>
/**
* Migrate data among browsers (export / import)
*/
export interface BrowserMigratable<N = BrowserMigratableNamespace> {
/**
* The name space for migration
*/
namespace: N
exportData(): Promise<Required<timer.backup.ExportData>[N]>
importData(data: unknown): Promise<void>
}