mirror of
https://github.com/motajs/template.git
synced 2026-09-18 21:20:20 +08:00
chore: 将事件执行标记为 ignoreReplay
This commit is contained in:
parent
b623e8ac98
commit
aa3c7296c7
@ -179,8 +179,9 @@ export function shouldReplay(message: string): ReplayDecorator {
|
||||
/**
|
||||
* 将一个类的方法标记为忽略录像安全检查,一般用于异步内容等不是立刻会触发状态修改的方法,
|
||||
* 不要使用此方法来规避控制台的录像错误警告,否则很可能导致录像出错。
|
||||
* @param _msg 忽略录像记录的原因
|
||||
*/
|
||||
export function ignoreReplay(): ReplayDecorator {
|
||||
export function ignoreReplay(_msg: string): ReplayDecorator {
|
||||
return function <This, Args extends unknown[], Return>(
|
||||
this: This,
|
||||
method: ReplayMethod<This, Args, Return>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { logger } from '@motajs/common';
|
||||
import { IGameEventStore } from '@user/data-common';
|
||||
import { IGameEventStore, ignoreReplay } from '@user/data-common';
|
||||
import { AnonTokyoInterpreter } from '@motajs/anon-tokyo';
|
||||
import {
|
||||
EventExecuteMode,
|
||||
@ -52,6 +52,8 @@ export class EventExecutor implements IGameEventExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error 泛型无法推导
|
||||
@ignoreReplay('事件一般由其他动作被动触发,不应计入录像')
|
||||
async execute<R = void>(
|
||||
events: IGameEventInvocation[],
|
||||
param: IBlockEventParam
|
||||
|
||||
Loading…
Reference in New Issue
Block a user