Method
constructor
(localStorageKey: string, parent: any, defaults: T, storage: {get: (storageKey: string, callback: (items: { [key: string]: any }) => void) => void; set: (items: { [key: string]: any }, callback: () => void) => void}, addListener: (listener: (data: T) => void) => void, logWarn: (log: string) => void)
Source from the content-addressed store, hash-verified
| 114 | private listeners: Set<() => void>; |
| 115 | |
| 116 | constructor(localStorageKey: string, parent: any, defaults: T, storage: {get: (storageKey: string, callback: (items: { [key: string]: any }) => void) => void; set: (items: { [key: string]: any }, callback: () => void) => void}, addListener: (listener: (data: T) => void) => void, logWarn: (log: string) => void){ |
| 117 | this.localStorageKey = localStorageKey; |
| 118 | this.parent = parent; |
| 119 | this.defaults = defaults; |
| 120 | this.storage = storage; |
| 121 | addListener((change) => this.onChange(change)); |
| 122 | this.logWarn = logWarn; |
| 123 | |
| 124 | this.meta = StateManagerImplState.INITIAL; |
| 125 | this.barrier = new PromiseBarrier(); |
| 126 | this.listeners = new Set(); |
| 127 | |
| 128 | // TODO(Anton): consider calling this.loadState() to preload data, |
| 129 | // and remove StateManagerImplState.INITIAL. |
| 130 | } |
| 131 | |
| 132 | private collectState() { |
| 133 | const state = {} as T; |
Callers
nothing calls this directly
Tested by
no test coverage detected