@vnejs/module.controller.bg 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
@@ -19,8 +19,6 @@ export declare abstract class ModuleControllerBg<TEvents extends ModuleControlle
19
19
  subscribe: () => void;
20
20
  start: () => Promise<HTMLImageElement> | undefined;
21
21
  getDefaultState: () => TState;
22
- onShow: () => void;
23
- onHide: () => void;
24
22
  onShowBefore: () => Promise<void>;
25
23
  onMemoryCleared: () => Promise<void>;
26
24
  loadBg: () => Promise<HTMLImageElement>;
package/dist/index.js CHANGED
@@ -8,10 +8,9 @@ export class ModuleControllerBg extends ModuleCore {
8
8
  IS_MEMORY_CLEARED_PRELOAD_ENABLED = false;
9
9
  IS_MEMORY_CLEARED_UPDATE_ENABLED = false;
10
10
  subscribe = () => {
11
- const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
11
+ const { SHOW } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
12
12
  this.on(this.EVENT_SHOW, this.onShowBefore, { priority: SHOW.BEFORE });
13
- this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.MAIN });
14
- this.on(this.EVENT_HIDE, this.onHide, { priority: HIDE.MAIN });
13
+ this.on(this.EVENT_UPDATE_STATE, this.updateState);
15
14
  if (this.EVENT_PRELOAD)
16
15
  this.on(this.EVENT_PRELOAD, this.loadBg);
17
16
  this.on(this.EVENTS.MEMORY.CLEARED, this.onMemoryCleared);
@@ -23,14 +22,6 @@ export class ModuleControllerBg extends ModuleCore {
23
22
  return this.loadBg();
24
23
  };
25
24
  getDefaultState = () => ({ isShow: false });
26
- onShow = () => {
27
- this.updateState({ isShow: true });
28
- };
29
- onHide = () => {
30
- if (!this.state.isShow)
31
- return;
32
- this.updateState({ isShow: false });
33
- };
34
25
  onShowBefore = async () => {
35
26
  const media = await this.loadBg();
36
27
  await this.emit(this.EVENT_UPDATE_STATE, { bgSrc: media.src });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.bg",
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,11 +43,10 @@ export abstract class ModuleControllerBg<
43
43
  IS_MEMORY_CLEARED_UPDATE_ENABLED = false;
44
44
 
45
45
  subscribe = () => {
46
- const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
46
+ const { SHOW } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
47
47
 
48
48
  this.on(this.EVENT_SHOW, this.onShowBefore, { priority: SHOW.BEFORE });
49
- this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.MAIN });
50
- this.on(this.EVENT_HIDE, this.onHide, { priority: HIDE.MAIN });
49
+ this.on(this.EVENT_UPDATE_STATE, this.updateState);
51
50
 
52
51
  if (this.EVENT_PRELOAD) this.on(this.EVENT_PRELOAD, this.loadBg);
53
52
 
@@ -62,16 +61,6 @@ export abstract class ModuleControllerBg<
62
61
 
63
62
  getDefaultState = (): TState => ({ isShow: false }) as TState;
64
63
 
65
- onShow = () => {
66
- this.updateState({ isShow: true } as Partial<TState>);
67
- };
68
-
69
- onHide = () => {
70
- if (!this.state.isShow) return;
71
-
72
- this.updateState({ isShow: false } as Partial<TState>);
73
- };
74
-
75
64
  onShowBefore = async () => {
76
65
  const media = await this.loadBg();
77
66