@vnejs/plugins.scenario.qte 0.1.1 → 0.1.2
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/modules/qte.d.ts +1 -0
- package/dist/modules/qte.js +8 -2
- package/package.json +1 -1
- package/src/modules/qte.ts +11 -2
package/dist/modules/qte.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { QtePluginConstants, QtePluginEvents, QtePluginParams, QtePluginSet
|
|
|
3
3
|
import type { QteEmitPayload, QteResultPayload } from "../utils/qte.js";
|
|
4
4
|
export declare class Qte extends ModuleCore<QtePluginEvents, QtePluginConstants, QtePluginSettings, QtePluginParams> {
|
|
5
5
|
name: string;
|
|
6
|
+
skipScenario: boolean;
|
|
6
7
|
subscribe: () => void;
|
|
7
8
|
onQteEmit: (payload?: QteEmitPayload) => Promise<void>;
|
|
8
9
|
onQteResult: ({ success }?: QteResultPayload) => Promise<void>;
|
package/dist/modules/qte.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
export class Qte extends ModuleCore {
|
|
3
3
|
name = "qte";
|
|
4
|
+
skipScenario = false;
|
|
4
5
|
subscribe = () => {
|
|
5
6
|
this.on(this.EVENTS.QTE.EMIT, this.onQteEmit);
|
|
6
7
|
this.on(this.EVENTS.QTE.RESULT, this.onQteResult);
|
|
7
8
|
};
|
|
8
9
|
onQteEmit = async (payload = {}) => {
|
|
9
|
-
this.
|
|
10
|
+
this.skipScenario = !!payload.skipScenario;
|
|
11
|
+
this.emitLog({ action: "emit", id: payload.id, skipScenario: this.skipScenario });
|
|
10
12
|
await this.emit(this.EVENTS.QTE.OPENED, payload);
|
|
11
13
|
};
|
|
12
14
|
onQteResult = async ({ success = false } = {}) => {
|
|
13
|
-
this.emitLog({ action: "result", success });
|
|
15
|
+
this.emitLog({ action: "result", success, skipScenario: this.skipScenario });
|
|
14
16
|
await this.emit(this.EVENTS.QTE.CLOSED, { isForce: false });
|
|
17
|
+
if (this.skipScenario) {
|
|
18
|
+
this.skipScenario = false;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
15
21
|
await this.applyResult(success);
|
|
16
22
|
this.emitNext();
|
|
17
23
|
};
|
package/package.json
CHANGED
package/src/modules/qte.ts
CHANGED
|
@@ -6,19 +6,28 @@ import type { QteEmitPayload, QteResultPayload, QteVisibilityPayload, ScenarioLi
|
|
|
6
6
|
export class Qte extends ModuleCore<QtePluginEvents, QtePluginConstants, QtePluginSettings, QtePluginParams> {
|
|
7
7
|
name = "qte";
|
|
8
8
|
|
|
9
|
+
skipScenario = false;
|
|
10
|
+
|
|
9
11
|
subscribe = () => {
|
|
10
12
|
this.on(this.EVENTS.QTE.EMIT, this.onQteEmit);
|
|
11
13
|
this.on(this.EVENTS.QTE.RESULT, this.onQteResult);
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
onQteEmit = async (payload: QteEmitPayload = {}) => {
|
|
15
|
-
this.
|
|
17
|
+
this.skipScenario = !!payload.skipScenario;
|
|
18
|
+
this.emitLog({ action: "emit", id: payload.id, skipScenario: this.skipScenario });
|
|
16
19
|
await this.emit(this.EVENTS.QTE.OPENED, payload satisfies QteVisibilityPayload);
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
onQteResult = async ({ success = false }: QteResultPayload = {}) => {
|
|
20
|
-
this.emitLog({ action: "result", success });
|
|
23
|
+
this.emitLog({ action: "result", success, skipScenario: this.skipScenario });
|
|
21
24
|
await this.emit(this.EVENTS.QTE.CLOSED, { isForce: false } satisfies QteVisibilityPayload);
|
|
25
|
+
|
|
26
|
+
if (this.skipScenario) {
|
|
27
|
+
this.skipScenario = false;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
await this.applyResult(success);
|
|
23
32
|
this.emitNext();
|
|
24
33
|
};
|