@vnejs/plugins.time.time 0.2.1 → 0.2.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.
@@ -1,14 +1,15 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
2
  import type { LineExecHandlerArg } from "@vnejs/module.core";
3
3
  import type { TimePluginConstants, TimePluginEvents, TimePluginParams, TimePluginSettings } from "../types.js";
4
- import type { TimeState, TimeValuePayload } from "../utils/time.js";
4
+ import type { TimeState } from "../utils/time.js";
5
+ import type { TimeValuePayload } from "@vnejs/contracts.time.time";
5
6
  export declare class Time extends ModuleCore<TimePluginEvents, TimePluginConstants, TimePluginSettings, TimePluginParams, TimeState> {
6
7
  name: string;
7
8
  subscribe: () => void;
8
- init: () => Promise<unknown[]> | undefined;
9
+ init: () => Promise<import("@vnejs/shared").EmitResults<"vne:scenario:line_exec_reg">> | undefined;
9
10
  onLineExec: ({ line }?: LineExecHandlerArg) => Promise<void>;
10
11
  onTimeSet: ({ hours, minutes, seconds }?: TimeValuePayload) => void;
11
12
  onTimeAdd: ({ hours, minutes, seconds }?: TimeValuePayload) => void;
12
- emitTimeEvent: (action: string, arg: TimeValuePayload) => Promise<unknown[]> | undefined;
13
+ emitTimeEvent: (action: string, arg: TimeValuePayload) => Promise<import("@vnejs/shared").EmitResults<"vne:time:add">> | undefined;
13
14
  getDefaultState: () => TimeState;
14
15
  }
@@ -12,7 +12,7 @@ export class Time extends ModuleCore {
12
12
  onLineExec = async ({ line = "" } = {}) => {
13
13
  const [action = "", hours = 0, minutes = 0, seconds = 0] = tokenizeExecLine(line);
14
14
  await this.emitTimeEvent(String(action), { hours: Number(hours), minutes: Number(minutes), seconds: Number(seconds) });
15
- this.emitNext();
15
+ this.emit(this.EVENTS.SCENARIO.NEXT);
16
16
  };
17
17
  onTimeSet = ({ hours = 0, minutes = 0, seconds = 0 } = {}) => {
18
18
  this.setState({ hours, minutes, seconds });
@@ -3,8 +3,3 @@ export type TimeState = {
3
3
  minutes: number;
4
4
  seconds: number;
5
5
  };
6
- export type TimeValuePayload = {
7
- hours?: number;
8
- minutes?: number;
9
- seconds?: number;
10
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.time.time",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,7 +4,8 @@ import { tokenizeExecLine } from "@vnejs/helpers";
4
4
  import type { LineExecHandlerArg } from "@vnejs/module.core";
5
5
 
6
6
  import type { TimePluginConstants, TimePluginEvents, TimePluginParams, TimePluginSettings } from "../types.js";
7
- import type { TimeState, TimeValuePayload } from "../utils/time.js";
7
+ import type { TimeState } from "../utils/time.js";
8
+ import type { TimeValuePayload } from "@vnejs/contracts.time.time";
8
9
 
9
10
  export class Time extends ModuleCore<TimePluginEvents, TimePluginConstants, TimePluginSettings, TimePluginParams, TimeState> {
10
11
  name = "time";
@@ -24,7 +25,7 @@ export class Time extends ModuleCore<TimePluginEvents, TimePluginConstants, Time
24
25
 
25
26
  await this.emitTimeEvent(String(action), { hours: Number(hours), minutes: Number(minutes), seconds: Number(seconds) });
26
27
 
27
- this.emitNext();
28
+ this.emit(this.EVENTS.SCENARIO.NEXT);
28
29
  };
29
30
 
30
31
  onTimeSet = ({ hours = 0, minutes = 0, seconds = 0 }: TimeValuePayload = {}) => {
package/src/utils/time.ts CHANGED
@@ -3,9 +3,3 @@ export type TimeState = {
3
3
  minutes: number;
4
4
  seconds: number;
5
5
  };
6
-
7
- export type TimeValuePayload = {
8
- hours?: number;
9
- minutes?: number;
10
- seconds?: number;
11
- };