@vnejs/module.controller.preload 0.2.4 → 0.2.5

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/dist/index.d.ts CHANGED
@@ -10,10 +10,10 @@ export declare abstract class ModuleControllerPreload<TEvents extends ModuleCont
10
10
  PRELOAD_LABELS: string[];
11
11
  PRELOAD_EVENTS: string[];
12
12
  subscribe: () => void;
13
- getDefaultState: () => TState;
14
13
  onShow: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
15
14
  onPreload: () => Promise<(import("@vnejs/shared").EmitResults<string> | import("@vnejs/shared").EmitResults<"vne:scenario:label_get"> | undefined)[]>;
16
15
  onMemoryCleared: () => false | undefined;
16
+ getDefaultState: () => TState;
17
17
  emitLabelGet: (label: string) => Promise<import("@vnejs/shared").EmitResults<"vne:scenario:label_get">> | undefined;
18
18
  emitEvent: (event: string) => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
19
19
  }
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ export class ModuleControllerPreload extends ModuleCore {
9
9
  this.on(this.EVENT_UPDATE_STATE, this.updateState);
10
10
  this.on(this.EVENTS.MEMORY.CLEARED, this.onMemoryCleared);
11
11
  };
12
- getDefaultState = () => ({ isShow: false });
13
12
  onShow = () => this.emit(this.EVENT_PRELOAD);
14
13
  onPreload = () => Promise.all([...this.PRELOAD_LABELS.map(this.emitLabelGet), ...this.PRELOAD_EVENTS.map(this.emitEvent)]);
15
14
  onMemoryCleared = () => this.state.isShow && void this.emit(this.EVENT_PRELOAD);
15
+ getDefaultState = () => ({ isShow: false });
16
16
  emitLabelGet = (label) => this.emit(this.EVENTS.SCENARIO.LABEL_GET, { label });
17
17
  emitEvent = (event) => this.emit(event);
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.preload",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -43,13 +43,14 @@ export abstract class ModuleControllerPreload<
43
43
  this.on(this.EVENTS.MEMORY.CLEARED, this.onMemoryCleared);
44
44
  };
45
45
 
46
- getDefaultState = (): TState => ({ isShow: false }) as TState;
47
-
48
46
  onShow = () => this.emit(this.EVENT_PRELOAD);
49
47
 
50
48
  onPreload = () => Promise.all([...this.PRELOAD_LABELS.map(this.emitLabelGet), ...this.PRELOAD_EVENTS.map(this.emitEvent)]);
49
+
51
50
  onMemoryCleared = () => this.state.isShow && void this.emit(this.EVENT_PRELOAD);
52
51
 
52
+ getDefaultState = (): TState => ({ isShow: false }) as TState;
53
+
53
54
  emitLabelGet = (label: string) => this.emit(this.EVENTS.SCENARIO.LABEL_GET, { label });
54
55
  emitEvent = (event: string) => this.emit(event);
55
56
  }