@vnejs/module.controller.accept 0.2.7 → 0.2.8

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 ModuleControllerAccept<TEvents extends ModuleContr
10
10
  abstract CONTROLS_ZINDEX: number;
11
11
  IS_ACCEPT_ENABLED: boolean;
12
12
  IS_INTERACT_ENABLED: boolean;
13
- emitAccept: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
14
- get CONTROLS(): Record<string, () => void>;
15
13
  subscribe: () => void;
16
- abstract onAccept: () => void | Promise<void>;
17
14
  onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
18
15
  onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
16
+ abstract onAccept: () => void | Promise<void>;
17
+ emitAccept: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
18
+ get CONTROLS(): Record<string, () => void>;
19
19
  }
package/dist/index.js CHANGED
@@ -3,15 +3,6 @@ export class ModuleControllerAccept extends ModuleCore {
3
3
  EVENT_UPDATE_STATE;
4
4
  IS_ACCEPT_ENABLED = true;
5
5
  IS_INTERACT_ENABLED = true;
6
- emitAccept = () => this.emit(this.EVENT_ACCEPT);
7
- get CONTROLS() {
8
- const controls = {};
9
- if (this.IS_ACCEPT_ENABLED)
10
- controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
11
- if (this.IS_INTERACT_ENABLED)
12
- controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
13
- return controls;
14
- }
15
6
  subscribe = () => {
16
7
  const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
17
8
  this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
@@ -30,4 +21,13 @@ export class ModuleControllerAccept extends ModuleCore {
30
21
  this.setDefaultState();
31
22
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
32
23
  };
24
+ emitAccept = () => this.emit(this.EVENT_ACCEPT);
25
+ get CONTROLS() {
26
+ const controls = {};
27
+ if (this.IS_ACCEPT_ENABLED)
28
+ controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
29
+ if (this.IS_INTERACT_ENABLED)
30
+ controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
31
+ return controls;
32
+ }
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.accept",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -36,17 +36,6 @@ export abstract class ModuleControllerAccept<
36
36
  IS_ACCEPT_ENABLED = true;
37
37
  IS_INTERACT_ENABLED = true;
38
38
 
39
- emitAccept = () => this.emit(this.EVENT_ACCEPT);
40
-
41
- get CONTROLS() {
42
- const controls: Record<string, () => void> = {};
43
-
44
- if (this.IS_ACCEPT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
45
- if (this.IS_INTERACT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
46
-
47
- return controls;
48
- }
49
-
50
39
  subscribe = () => {
51
40
  const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
52
41
 
@@ -56,8 +45,6 @@ export abstract class ModuleControllerAccept<
56
45
  if (this.EVENT_UPDATE_STATE) this.on(this.EVENT_UPDATE_STATE, this.updateState);
57
46
  };
58
47
 
59
- abstract onAccept: () => void | Promise<void>;
60
-
61
48
  onShow = () =>
62
49
  this.emit(this.EVENTS.CONTROLS.PUSH, {
63
50
  key: this.name,
@@ -71,4 +58,17 @@ export abstract class ModuleControllerAccept<
71
58
 
72
59
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
73
60
  };
61
+
62
+ abstract onAccept: () => void | Promise<void>;
63
+
64
+ emitAccept = () => this.emit(this.EVENT_ACCEPT);
65
+
66
+ get CONTROLS() {
67
+ const controls: Record<string, () => void> = {};
68
+
69
+ if (this.IS_ACCEPT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
70
+ if (this.IS_INTERACT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
71
+
72
+ return controls;
73
+ }
74
74
  }