UNPKG

1.53 kBTypeScriptView Raw
1import { ILogger } from '../common/logger';
2import { MessageService } from '../common/message-service';
3import { WindowService } from './window/window-service';
4export declare const StorageService: unique symbol;
5/**
6 * The storage service provides an interface to some data storage that allows extensions to keep state among sessions.
7 */
8export interface StorageService {
9 /**
10 * Stores the given data under the given key.
11 */
12 setData<T>(key: string, data: T): Promise<void>;
13 /**
14 * Returns the data stored for the given key or the provided default value if nothing is stored for the given key.
15 */
16 getData<T>(key: string, defaultValue: T): Promise<T>;
17 getData<T>(key: string): Promise<T | undefined>;
18}
19export declare class LocalStorageService implements StorageService {
20 private storage;
21 protected logger: ILogger;
22 protected readonly messageService: MessageService;
23 protected readonly windowService: WindowService;
24 protected init(): void;
25 setData<T>(key: string, data?: T): Promise<void>;
26 getData<T>(key: string, defaultValue?: T): Promise<T | undefined>;
27 protected prefix(key: string): string;
28 private showDiskQuotaExceededMessage;
29 /**
30 * Verify if there is still some spaces left to save another workspace configuration into the local storage of your browser.
31 * If we are close to the limit, use a dialog to notify the user.
32 */
33 private testLocalStorage;
34 private clearStorage;
35}
36//# sourceMappingURL=storage-service.d.ts.map
\No newline at end of file