Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

StorageOptions

interfaz Since 1.2.0

Opciones de useStorage.

ts
import type { StorageOptions } from "@meekojs/meeko/framework";

Source code src/app/composables/useStorage.ts:59

Declaración #

ts
interface StorageOptions<T = unknown> {
	readonly storage?: StorageArea
	readonly schema?: StorageSchema<T>
}

Type parameters #

T = unknown

Tipo del valor guardado.

Example #

ts
import * as v from "valibot";
import type { StorageOptions } from "@meekojs/meeko/framework";

const options: StorageOptions<string[]> = { storage: "local", schema: v.array(v.string()) };
const ids = useStorage("cart:ids", [] as string[], options);

Propiedades #

storage #

propiedad sólo lectura opcional

readonly storage?: StorageArea

Dónde se guarda el valor: "local" (por defecto) o "session".

schema #

propiedad sólo lectura opcional

readonly schema?: StorageSchema<T>

Standard Schema (Valibot, Zod…) que valida lo que se lee del almacenamiento, también lo que llega de otra pestaña. Un valor que no lo cumple se ignora y la señal usa el valor inicial. Debe validar de forma síncrona.

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/app/composables/useStorage.ts