@tb-dev/vue 0.2.2 → 0.3.0
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,10 +1,12 @@
|
|
|
1
|
-
import { ShallowRef } from 'vue';
|
|
2
1
|
import { UseAsyncStateOptions } from '@vueuse/core';
|
|
3
2
|
type Options = Omit<UseAsyncStateOptions<true>, 'shallow'>;
|
|
4
3
|
export interface AsyncRefOptions extends Options {
|
|
5
4
|
immediate?: boolean;
|
|
6
5
|
}
|
|
7
|
-
export declare function asyncRef<T>(initial: T, fn: () => Promise<T>, options?: AsyncRefOptions):
|
|
6
|
+
export declare function asyncRef<T>(initial: T, fn: () => Promise<T>, options?: AsyncRefOptions): {
|
|
7
|
+
state: import('vue').Ref<T, T>;
|
|
8
8
|
execute: (delay?: number, ...args: any[]) => Promise<T>;
|
|
9
|
+
isLoading: import('vue').Ref<boolean, boolean>;
|
|
10
|
+
isReady: import('vue').Ref<boolean, boolean>;
|
|
9
11
|
};
|
|
10
12
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -3885,7 +3885,7 @@ function asyncComputed(initial, callback, options) {
|
|
|
3885
3885
|
|
|
3886
3886
|
function asyncRef(initial, fn, options = {}) {
|
|
3887
3887
|
const { immediate = true } = options;
|
|
3888
|
-
const { execute, state } = useAsyncState(fn, initial, {
|
|
3888
|
+
const { execute, state, isLoading, isReady } = useAsyncState(fn, initial, {
|
|
3889
3889
|
immediate,
|
|
3890
3890
|
onError: handleError,
|
|
3891
3891
|
resetOnExecute: false,
|
|
@@ -3893,7 +3893,12 @@ function asyncRef(initial, fn, options = {}) {
|
|
|
3893
3893
|
throwError: false,
|
|
3894
3894
|
...options
|
|
3895
3895
|
});
|
|
3896
|
-
return
|
|
3896
|
+
return {
|
|
3897
|
+
state,
|
|
3898
|
+
execute,
|
|
3899
|
+
isLoading,
|
|
3900
|
+
isReady
|
|
3901
|
+
};
|
|
3897
3902
|
}
|
|
3898
3903
|
|
|
3899
3904
|
function useWindowHeight() {
|