@vnejs/plugins.views.achievement 0.2.4 → 0.2.6
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/exec.js +1 -1
- package/dist/modules/logs.js +2 -2
- package/package.json +1 -1
- package/src/modules/exec.ts +1 -1
- package/src/modules/logs.ts +4 -2
- package/src/tests/exec.test.ts +1 -1
- package/src/tests/logs.test.ts +1 -1
package/dist/modules/exec.js
CHANGED
|
@@ -9,7 +9,7 @@ export class AchievementExec extends ModuleCore {
|
|
|
9
9
|
onLineExec = async ({ keywords = [], line = "" } = {}) => {
|
|
10
10
|
const [action = "", ...tokens] = tokenizeExecLine(line).map(String);
|
|
11
11
|
await this.emitActionExec(action, tokens, keywords);
|
|
12
|
-
this.
|
|
12
|
+
this.emit(this.EVENTS.SCENARIO.NEXT);
|
|
13
13
|
};
|
|
14
14
|
onLineLoad = ({ line = "", priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND } = {}) => {
|
|
15
15
|
const [action = "", ...tokens] = tokenizeExecLine(line).map(String);
|
package/dist/modules/logs.js
CHANGED
|
@@ -5,6 +5,6 @@ export class AchievementLogs extends ModuleCore {
|
|
|
5
5
|
this.on(this.EVENTS.ACHIEVEMENT.LOCKED, this.onAchievementLocked, this.CONST.LOGS.FILTER_FROM_RESULT_OPTIONS);
|
|
6
6
|
this.on(this.EVENTS.ACHIEVEMENT.UNLOCKED, this.onAchievementUnlocked, this.CONST.LOGS.FILTER_FROM_RESULT_OPTIONS);
|
|
7
7
|
};
|
|
8
|
-
onAchievementLocked = ({ id = "" } = {}) => void this.
|
|
9
|
-
onAchievementUnlocked = ({ id = "" } = {}) => void this.
|
|
8
|
+
onAchievementLocked = ({ id = "" } = {}) => void this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.ACHIEVEMENT.LOGS_ACTIONS.LOCKED, id });
|
|
9
|
+
onAchievementUnlocked = ({ id = "" } = {}) => void this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.ACHIEVEMENT.LOGS_ACTIONS.UNLOCKED, id });
|
|
10
10
|
}
|
package/package.json
CHANGED
package/src/modules/exec.ts
CHANGED
|
@@ -19,7 +19,7 @@ export class AchievementExec extends ModuleCore<AchievementPluginEvents, Achieve
|
|
|
19
19
|
|
|
20
20
|
await this.emitActionExec(action, tokens, keywords);
|
|
21
21
|
|
|
22
|
-
this.
|
|
22
|
+
this.emit(this.EVENTS.SCENARIO.NEXT);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
onLineLoad = ({ line = "", priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND }: LineLoadHandlerArg = {}) => {
|
package/src/modules/logs.ts
CHANGED
|
@@ -11,7 +11,9 @@ export class AchievementLogs extends ModuleCore<AchievementPluginEvents, Achieve
|
|
|
11
11
|
this.on(this.EVENTS.ACHIEVEMENT.UNLOCKED, this.onAchievementUnlocked, this.CONST.LOGS.FILTER_FROM_RESULT_OPTIONS);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
onAchievementLocked = ({ id = "" }: AchievementLockedPayload = {}) =>
|
|
14
|
+
onAchievementLocked = ({ id = "" }: AchievementLockedPayload = {}) =>
|
|
15
|
+
void this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.ACHIEVEMENT.LOGS_ACTIONS.LOCKED, id });
|
|
15
16
|
|
|
16
|
-
onAchievementUnlocked = ({ id = "" }: AchievementUnlockedPayload = {}) =>
|
|
17
|
+
onAchievementUnlocked = ({ id = "" }: AchievementUnlockedPayload = {}) =>
|
|
18
|
+
void this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.ACHIEVEMENT.LOGS_ACTIONS.UNLOCKED, id });
|
|
17
19
|
}
|
package/src/tests/exec.test.ts
CHANGED
|
@@ -42,7 +42,7 @@ describe("AchievementExec", () => {
|
|
|
42
42
|
expect(load).toHaveBeenCalledOnce();
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it("line exec
|
|
45
|
+
it("line exec emits SCENARIO.NEXT", async () => {
|
|
46
46
|
const { module, observer } = createAchievementTestModule(AchievementExec, { subscribe: false });
|
|
47
47
|
const next = vi.fn();
|
|
48
48
|
|
package/src/tests/logs.test.ts
CHANGED
|
@@ -18,6 +18,6 @@ describe("AchievementLogs", () => {
|
|
|
18
18
|
await observer.emit(SUBSCRIBE_EVENTS.UNLOCKED, { id: "kekw" });
|
|
19
19
|
|
|
20
20
|
expect(log).toHaveBeenCalledOnce();
|
|
21
|
-
expect(log.mock.calls[0][0]).toMatchObject({
|
|
21
|
+
expect(log.mock.calls[0][0]).toMatchObject({ action: "unlocked", id: "kekw" });
|
|
22
22
|
});
|
|
23
23
|
});
|