@vnejs/module 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/modules/module.js CHANGED
@@ -2,6 +2,7 @@ import { VNE } from "@vnejs/shared";
2
2
 
3
3
  export class Module {
4
4
  isReady = false;
5
+ isOnlyLocalState = false;
5
6
 
6
7
  EVENTS = VNE.EVENTS;
7
8
  CONST = VNE.CONST;
@@ -17,7 +18,7 @@ export class Module {
17
18
 
18
19
  // state
19
20
  this.globalState = state;
20
- this.state = this.globalState[this.name] = this.getDefaultState() || {};
21
+ this.setState(this.getDefaultState() || {});
21
22
 
22
23
  this.shared = shared;
23
24
  this.media = media;
@@ -27,8 +28,12 @@ export class Module {
27
28
  init = async () => {}; // implement
28
29
 
29
30
  setState = (state = {}) => {
30
- this.globalState[this.name] = state;
31
- this.state = this.globalState[this.name];
31
+ if (this.isOnlyLocalState) {
32
+ this.state = state;
33
+ } else {
34
+ this.globalState[this.name] = state;
35
+ this.state = this.globalState[this.name];
36
+ }
32
37
  }; // abstract
33
38
 
34
39
  updateState = (state = {}) => this.setState({ ...this.state, ...state });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {