Skip to content
On this page

useStorageAsync

Category
Last Changed
2 months ago

Reactive Storage in with async support.

Prefer to useStorage

Type Declarations

Show Type Declarations
export interface StorageAsyncOptions<T>
  extends Omit<StorageOptions<T>, "serializer"> {
  /**
   * Custom data serialization
   */
  serializer?: SerializerAsync<T>
}
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRef<string>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<string>
): RemovableRef<string>
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRef<boolean>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<boolean>
): RemovableRef<boolean>
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRef<number>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<number>
): RemovableRef<number>
export declare function useStorageAsync<T>(
  key: string,
  initialValue: MaybeRef<T>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<T>
): RemovableRef<T>
export declare function useStorageAsync<T = unknown>(
  key: string,
  initialValue: MaybeRef<null>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<T>
): RemovableRef<T>
export interface StorageAsyncOptions<T>
  extends Omit<StorageOptions<T>, "serializer"> {
  /**
   * Custom data serialization
   */
  serializer?: SerializerAsync<T>
}
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRef<string>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<string>
): RemovableRef<string>
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRef<boolean>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<boolean>
): RemovableRef<boolean>
export declare function useStorageAsync(
  key: string,
  initialValue: MaybeRef<number>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<number>
): RemovableRef<number>
export declare function useStorageAsync<T>(
  key: string,
  initialValue: MaybeRef<T>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<T>
): RemovableRef<T>
export declare function useStorageAsync<T = unknown>(
  key: string,
  initialValue: MaybeRef<null>,
  storage?: StorageLikeAsync,
  options?: StorageAsyncOptions<T>
): RemovableRef<T>

Source

SourceDocs

Contributors

Anthony Fu
Andreas Weber

Changelog

v7.5.3 on 1/5/2022
77fe0 - fix(storage): caught DOMException accessing storage (#1124)
v7.4.1 on 12/23/2021
3aa49 - feat: ssr handlers (#1060)
v7.3.0 on 12/12/2021
169b0 - feat: new function
useStorageAsync has loaded