@vnejs/plugins.scenario.pause 0.1.1 → 0.1.3
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/index.js +1 -2
- package/modules/pause.js +5 -4
- package/package.json +1 -1
- package/const/const.js +0 -1
- package/const/settings.js +0 -0
package/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { regPlugin } from "@vnejs/shared";
|
|
2
2
|
|
|
3
|
-
import * as constants from "./const/const";
|
|
4
3
|
import { SUBSCRIBE_EVENTS } from "./const/events";
|
|
5
4
|
|
|
6
5
|
import { Pause } from "./modules/pause";
|
|
7
6
|
|
|
8
|
-
regPlugin("PAUSE", {
|
|
7
|
+
regPlugin("PAUSE", { events: SUBSCRIBE_EVENTS }, [Pause]);
|
package/modules/pause.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
|
+
import { tokenizeExecLine } from "@vnejs/helpers";
|
|
2
3
|
|
|
3
4
|
export class Pause extends Module {
|
|
4
5
|
name = "pause";
|
|
@@ -15,12 +16,12 @@ export class Pause extends Module {
|
|
|
15
16
|
this.on(this.EVENTS.STATE.CLEAR, this.onPauseEnd);
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.
|
|
19
|
+
init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.onLineExec });
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
const
|
|
21
|
+
onLineExec = ({ line = "", args = {} } = {}) => {
|
|
22
|
+
const [time = 0] = tokenizeExecLine(line);
|
|
22
23
|
|
|
23
|
-
return this.emit(this.EVENTS.PAUSE.START, time ? { time
|
|
24
|
+
return this.emit(this.EVENTS.PAUSE.START, time ? { time, ...args } : args);
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
onPauseStart = async ({ time } = {}) => {
|
package/package.json
CHANGED
package/const/const.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const LINE_REG = /^(?<time>\d+)?$/;
|
package/const/settings.js
DELETED
|
File without changes
|