Total Complexity | 4 |
Total Lines | 18 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { getGlobalStorageProvider } from "../browserApi/storageProvider"; |
||
17 | class Configuration { |
||
18 | constructor() { |
||
19 | this.settingsCache = new Map(); |
||
20 | } |
||
21 | |||
22 | getProperty(key, callback) { |
||
23 | if (this.settingsCache.has(key)) { |
||
24 | callback(this.settingsCache.get(key)); |
||
25 | } |
||
26 | else { |
||
27 | // OOOPS // currently all settings are default true. This isn´t a problem but there should be much better soloutions after migration to typescript.... |
||
28 | getGlobalStorageProvider().getData(key, true, value => { |
||
29 | this.settingsCache.set(key, value); |
||
30 | callback(value); |
||
31 | }); |
||
32 | } |
||
33 | } |
||
34 | } |
||
35 | |||
44 | } |