-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.ts
47 lines (41 loc) · 1.49 KB
/
index.ts
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
36
37
38
39
40
41
42
43
44
45
46
47
import { AnnotationResponse } from "../AnnotationService";
/**
* Keys for the data saved by this service
*/
export enum PersistedConfigKeys {
AllenMountPoint = "ALLEN_MOUNT_POINT",
CsvColumns = "CSV_COLUMNS",
DisplayAnnotations = "DISPLAY_ANNOTATIONS",
ImageJExecutable = "IMAGE_J_EXECUTABLE", // Deprecated
HasUsedApplicationBefore = "HAS_USED_APPLICATION_BEFORE",
UserSelectedApplications = "USER_SELECTED_APPLICATIONS",
}
export interface UserSelectedApplication {
defaultFileKinds: string[];
filePath: string;
}
export interface PersistedConfig {
[PersistedConfigKeys.CsvColumns]?: string[];
[PersistedConfigKeys.DisplayAnnotations]?: AnnotationResponse[];
[PersistedConfigKeys.ImageJExecutable]?: string; // Deprecated
[PersistedConfigKeys.HasUsedApplicationBefore]?: boolean;
[PersistedConfigKeys.UserSelectedApplications]?: UserSelectedApplication[];
}
/**
* Interface that defines a platform-dependent service for persistent configuration data.
*/
export default interface PersistentConfigService {
/**
* Retrieve the config value for the given key. Returns undefined if not present.
*/
get(key: PersistedConfigKeys): any;
/**
* Retrieve the config value for all possible keys.
*/
getAll(): PersistedConfig;
/**
* Save the config value at the given key. Overwrites any existing data for the key.
*/
persist(config: PersistedConfig): void;
persist(key: PersistedConfigKeys, value: any): void;
}