vue3-request 1.0.16 → 1.0.17
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/vue3-request.es.d.ts +7 -15
- package/package.json +1 -1
|
@@ -2,22 +2,14 @@ import { Reactive } from 'vue';
|
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { ToRefs } from 'vue';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare type CacheParamsType<D = any, P = any> = {
|
|
8
|
-
data: D;
|
|
9
|
-
params: P;
|
|
10
|
-
time: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export declare type CallbackType<D = any, P extends any[] = any> = (signal?: AbortSignal) => ServiceType<D, P>;
|
|
5
|
+
declare type CallbackType<D = any, P extends any[] = any> = (signal?: AbortSignal) => ServiceType<D, P>;
|
|
14
6
|
|
|
15
7
|
declare type DebounceOptionsType = {
|
|
16
8
|
leading?: boolean;
|
|
17
9
|
trailing?: boolean;
|
|
18
10
|
};
|
|
19
11
|
|
|
20
|
-
|
|
12
|
+
declare type IOptions<D, P extends any[]> = Partial<{
|
|
21
13
|
onBefore: (params: P) => void;
|
|
22
14
|
onSuccess: (data: D, params: P) => void;
|
|
23
15
|
onFinally: (params: P, data: D, error: Error) => void;
|
|
@@ -41,7 +33,7 @@ export declare type IOptions<D, P extends any[]> = Partial<{
|
|
|
41
33
|
throttleOptions: Reactive<ThrottleOptionsType> | ThrottleOptionsType;
|
|
42
34
|
}>;
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
declare interface IState<D, P extends any[]> {
|
|
45
37
|
data: D | undefined;
|
|
46
38
|
isLoading: boolean;
|
|
47
39
|
isFinished: boolean;
|
|
@@ -53,14 +45,14 @@ export declare interface IState<D, P extends any[]> {
|
|
|
53
45
|
declare type Plugin_2<D = any, P extends any[] = any> = (requestInstance: Request_2<D, P>, options: IOptions<D, P>) => PluginReturn<D, P>;
|
|
54
46
|
export { Plugin_2 as Plugin }
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
declare type PluginMethodsReturn<D, P extends any[]> = Partial<{
|
|
57
49
|
servicePromise?: ReturnType<ServiceType<D, P>>;
|
|
58
50
|
signal?: AbortSignal;
|
|
59
51
|
isStaleTime?: boolean;
|
|
60
52
|
isReady?: boolean;
|
|
61
53
|
}>;
|
|
62
54
|
|
|
63
|
-
|
|
55
|
+
declare type PluginReturn<D, P extends any[]> = Partial<{
|
|
64
56
|
onBefore: (params: P) => void;
|
|
65
57
|
onSuccess: (data: D, params: P) => void;
|
|
66
58
|
onFinally: (params: P, data: D, error: Error) => void;
|
|
@@ -88,7 +80,7 @@ declare class Request_2<D, P extends any[]> {
|
|
|
88
80
|
cancel: () => void;
|
|
89
81
|
}
|
|
90
82
|
|
|
91
|
-
|
|
83
|
+
declare type ServiceType<D = any, P extends any[] = any> = (...args: P) => Promise<D>;
|
|
92
84
|
|
|
93
85
|
declare type ThrottleOptionsType = {
|
|
94
86
|
leading?: boolean;
|
|
@@ -97,7 +89,7 @@ declare type ThrottleOptionsType = {
|
|
|
97
89
|
|
|
98
90
|
export declare function useRequest<D, P extends any[]>(service: CallbackType<D, P>, options?: IOptions<D, P>, plugins?: Plugin_2<D, P>[]): UseRequestReturnType<D, P>;
|
|
99
91
|
|
|
100
|
-
|
|
92
|
+
declare interface UseRequestReturnType<D, P extends any[]> extends ToRefs<IState<D, P>> {
|
|
101
93
|
run: (...args: P) => void;
|
|
102
94
|
cancel: () => void;
|
|
103
95
|
refresh: () => void;
|
package/package.json
CHANGED