@vnejs/plugins.views.achievement 0.1.7 → 0.1.9

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,21 +1,13 @@
1
1
  import { Module } from "@vnejs/module";
2
+ import type { LineExecHandlerArg, LineLoadHandlerArg } from "@vnejs/plugins.core.scenario.contract";
2
3
  import type { AchievementPluginConstants, AchievementPluginEvents, AchievementPluginParams, AchievementPluginSettings } from "../types.js";
3
- type LineExecPayload = {
4
- keywords?: string[];
5
- line?: string;
6
- };
7
- type LineLoadPayload = {
8
- line?: string;
9
- priority?: number;
10
- };
11
4
  export declare class AchievementExec extends Module<AchievementPluginEvents, AchievementPluginConstants, AchievementPluginSettings, AchievementPluginParams> {
12
5
  name: string;
13
6
  init: () => Promise<[unknown[] | undefined, unknown[] | undefined]>;
14
- onLineExec: ({ keywords, line }?: LineExecPayload) => Promise<void>;
15
- onLineLoad: ({ line, priority }?: LineLoadPayload) => Promise<unknown> | undefined;
7
+ onLineExec: ({ keywords, line }?: LineExecHandlerArg) => Promise<void>;
8
+ onLineLoad: ({ line, priority }?: LineLoadHandlerArg) => Promise<unknown> | undefined;
16
9
  emitActionExec: (action?: string, tokens?: string[], keywords?: string[]) => Promise<unknown> | undefined;
17
10
  emitUnlockExec: (id?: string, isSkipIfPossible?: boolean) => Promise<unknown> | undefined;
18
11
  emitActionLoad: (action?: string, tokens?: string[], priority?: number) => Promise<unknown> | undefined;
19
12
  emitUnlockLoad: (id?: string, priority?: number) => Promise<unknown> | undefined;
20
13
  }
21
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.views.achievement",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,17 +1,9 @@
1
1
  import { Module } from "@vnejs/module";
2
2
  import { tokenizeExecLine } from "@vnejs/helpers";
3
3
 
4
- import type { AchievementPluginConstants, AchievementPluginEvents, AchievementPluginParams, AchievementPluginSettings } from "../types.js";
5
-
6
- type LineExecPayload = {
7
- keywords?: string[];
8
- line?: string;
9
- };
4
+ import type { LineExecHandlerArg, LineLoadHandlerArg } from "@vnejs/plugins.core.scenario.contract";
10
5
 
11
- type LineLoadPayload = {
12
- line?: string;
13
- priority?: number;
14
- };
6
+ import type { AchievementPluginConstants, AchievementPluginEvents, AchievementPluginParams, AchievementPluginSettings } from "../types.js";
15
7
 
16
8
  export class AchievementExec extends Module<AchievementPluginEvents, AchievementPluginConstants, AchievementPluginSettings, AchievementPluginParams> {
17
9
  name = "achievement.exec";
@@ -22,7 +14,7 @@ export class AchievementExec extends Module<AchievementPluginEvents, Achievement
22
14
  this.emit(this.EVENTS.SCENARIO.LINE_LOAD_REG, { module: "achievement", handler: this.onLineLoad }),
23
15
  ]);
24
16
 
25
- onLineExec = async ({ keywords = [], line = "" }: LineExecPayload = {}) => {
17
+ onLineExec = async ({ keywords = [], line = "" }: LineExecHandlerArg = {}) => {
26
18
  const [action = "", ...tokens] = tokenizeExecLine(line).map(String);
27
19
 
28
20
  await this.emitActionExec(action, tokens, keywords);
@@ -30,7 +22,7 @@ export class AchievementExec extends Module<AchievementPluginEvents, Achievement
30
22
  this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
31
23
  };
32
24
 
33
- onLineLoad = ({ line = "", priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND }: LineLoadPayload = {}) => {
25
+ onLineLoad = ({ line = "", priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND }: LineLoadHandlerArg = {}) => {
34
26
  const [action = "", ...tokens] = tokenizeExecLine(line).map(String);
35
27
 
36
28
  return this.emitActionLoad(action, tokens, priority);