Skip to content

Commit 52db5cd

Browse files
committed
type(HookEvent): use AlovaHookEventType enum
1 parent f471b97 commit 52db5cd

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/helper/createHookEvent.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineProperty, forEach, objectKeys } from '@/helper';
22
import { symbolToStringTag, undefinedValue } from '@/helper/variables';
33
import { AlovaCompleteEvent, Method } from 'alova';
4-
import { SilentMethod, SQHookBehavior } from '~/typings/general';
4+
import { SQHookBehavior, SilentMethod } from '~/typings/general';
55

66
/**
77
* 创建统一的事件对象,它将承载以下事件
@@ -24,8 +24,23 @@ import { SilentMethod, SQHookBehavior } from '~/typings/general';
2424
* [RetriableRetryEvent]重试:method实例、sendArgs、retryTimes、retryDelay
2525
* [RetriableFailEvent]重试:method实例、sendArgs、错误对象、retryTimes
2626
*/
27+
28+
export const enum AlovaHookEventType {
29+
GlobalSQEvent = 0,
30+
GlobalSQSuccessEvent = 1,
31+
GlobalSQErrorEvent = 2,
32+
GlobalSQFailEvent = 3,
33+
ScopedSQEvent = 4,
34+
ScopedSQSuccessEvent = 5,
35+
ScopedSQErrorEvent = 6,
36+
ScopedSQCompleteEvent = 7,
37+
ScopedSQRetryEvent = 8,
38+
RetriableRetryEvent = 9,
39+
RetriableFailEvent = 10
40+
}
41+
2742
export default <S, E, R, T, RC, RE, RH>(
28-
eventType: number,
43+
eventType: AlovaHookEventType,
2944
method: Method<S, E, R, T, RC, RE, RH>,
3045
behavior?: SQHookBehavior,
3146
silentMethod?: SilentMethod<S, E, R, T, RC, RE, RH>,

0 commit comments

Comments
 (0)