mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
replacing toJS({}) to utils/cloneJson where might be necessary
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
f620c09095
commit
4fbefb648a
19 files changed
+110
-110
No files matched your search
@@ -49,9 +49,9 @@ export class ExamplePreferencesStore extends Store.ExtensionStore<ExamplePrefere
|
||||
}
|
||||
|
||||
toJSON(): ExamplePreferencesModel {
|
||||
return toJS({
|
||||
enabled: this.enabled
|
||||
});
|
||||
return {
|
||||
enabled: toJS(this.enabled),
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -71,7 +71,6 @@ The `enabled` field of the `ExamplePreferencesStore` is set to the value from th
|
||||
The `toJSON()` method is complementary to `fromStore()`.
|
||||
It is called when the store is being saved.
|
||||
`toJSON()` must provide a JSON serializable object, facilitating its storage in JSON format.
|
||||
The `toJS()` function from [`mobx`](https://mobx.js.org/README.html) is convenient for this purpose, and is used here.
|
||||
|
||||
Finally, `ExamplePreferencesStore` is created by calling `ExamplePreferencesStore.getInstanceOrCreate()`, and exported for use by other parts of the extension.
|
||||
Note that `ExamplePreferencesStore` is a singleton.
|
||||
|
||||
Reference in new issue
Block a user