@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 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", { constants, events: SUBSCRIBE_EVENTS }, [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.execHandler });
19
+ init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.onLineExec });
19
20
 
20
- execHandler = (line, args) => {
21
- const { time } = line.match(this.CONST.PAUSE.LINE_REG).groups;
21
+ onLineExec = ({ line = "", args = {} } = {}) => {
22
+ const [time = 0] = tokenizeExecLine(line);
22
23
 
23
- return this.emit(this.EVENTS.PAUSE.START, time ? { time: Number(time), ...args } : args);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.scenario.pause",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/const/const.js DELETED
@@ -1 +0,0 @@
1
- export const LINE_REG = /^(?<time>\d+)?$/;
package/const/settings.js DELETED
File without changes