@tb-dev/vue 4.0.1 → 4.0.2
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.
|
@@ -6,7 +6,7 @@ export interface AsyncRefOptions extends Options {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function asyncRef<T>(initial: T, fn: () => Promise<T>, options?: AsyncRefOptions): {
|
|
8
8
|
state: ShallowRef<T>;
|
|
9
|
-
|
|
9
|
+
loading: Readonly<Ref<boolean>>;
|
|
10
10
|
isReady: Readonly<Ref<boolean>>;
|
|
11
11
|
execute: () => Promise<void>;
|
|
12
12
|
};
|
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
initOnMounted?: boolean;
|
|
5
|
-
listenToStorageChanges?: boolean;
|
|
6
|
-
mergeDefaults?: boolean;
|
|
7
|
-
onError?: (err: unknown) => void;
|
|
8
|
-
shallow?: boolean;
|
|
9
|
-
writeDefaults?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function localRef<T>(key: string, initial: T, options?: LocalRefOptions): Ref<T>;
|
|
2
|
+
import { UseStorageOptions } from '@vueuse/core';
|
|
3
|
+
export declare function localRef<T>(key: string, initial: T, options?: UseStorageOptions<T>): Ref<T>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
initOnMounted?: boolean;
|
|
5
|
-
listenToStorageChanges?: boolean;
|
|
6
|
-
onError?: (err: unknown) => void;
|
|
7
|
-
writeDefaults?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function sessionRef<T>(key: string, initial: T, options?: SessionRefOptions): Ref<T>;
|
|
2
|
+
import { UseStorageOptions } from '@vueuse/core';
|
|
3
|
+
export declare function sessionRef<T>(key: string, initial: T, options?: UseStorageOptions<T>): Ref<T>;
|
package/dist/index.js
CHANGED
|
@@ -150,7 +150,7 @@ function asyncRef(initial, fn, options = {}) {
|
|
|
150
150
|
};
|
|
151
151
|
return {
|
|
152
152
|
state: value.state,
|
|
153
|
-
|
|
153
|
+
loading: value.isLoading,
|
|
154
154
|
isReady: value.isReady,
|
|
155
155
|
execute
|
|
156
156
|
};
|
|
@@ -163,12 +163,12 @@ function localRef(key, initial, options) {
|
|
|
163
163
|
listenToStorageChanges: options?.listenToStorageChanges ?? true,
|
|
164
164
|
mergeDefaults: options?.mergeDefaults ?? true,
|
|
165
165
|
onError: options?.onError ?? handleError,
|
|
166
|
-
shallow: options?.shallow,
|
|
167
166
|
writeDefaults: options?.writeDefaults ?? true,
|
|
168
167
|
serializer: {
|
|
169
168
|
read: JSON.parse,
|
|
170
169
|
write: JSON.stringify
|
|
171
|
-
}
|
|
170
|
+
},
|
|
171
|
+
...options
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -232,23 +232,18 @@ function onCtrlShiftKeyDown(key, handler, options) {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
function sessionRef(key, initial, options) {
|
|
235
|
-
|
|
236
|
-
const session = useSessionStorage(key, defaultValue, {
|
|
235
|
+
return useSessionStorage(key, initial, {
|
|
237
236
|
deep: options?.deep ?? true,
|
|
238
237
|
initOnMounted: options?.initOnMounted ?? true,
|
|
239
238
|
listenToStorageChanges: options?.listenToStorageChanges ?? true,
|
|
239
|
+
mergeDefaults: options?.mergeDefaults ?? true,
|
|
240
240
|
onError: options?.onError ?? handleError,
|
|
241
241
|
writeDefaults: options?.writeDefaults ?? true,
|
|
242
242
|
serializer: {
|
|
243
243
|
read: JSON.parse,
|
|
244
244
|
write: JSON.stringify
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return computed({
|
|
248
|
-
get: () => session.value.inner,
|
|
249
|
-
set: (value) => {
|
|
250
|
-
session.value.inner = value;
|
|
251
|
-
}
|
|
245
|
+
},
|
|
246
|
+
...options
|
|
252
247
|
});
|
|
253
248
|
}
|
|
254
249
|
|