Skip to content

Releases: efstajas/svelte-stored-writable

v0.2.0

13 Apr 15:36
011bfc1
Compare
Choose a tag to compare

Automatically keeps changes to the localStorage key from other documents (tabs, windows) in sync (#1).

v0.1.3

21 Mar 11:34
fa7f78d
Compare
Choose a tag to compare

New feature:

Setting a custom writable type

If you want to use a custom TypeScript type for the storedWritable, you can pass an optional type parameter. When setting a type parameter,
your schema parameter must match the supplied type.

import storedWritable from '@efstajas/svelte-stored-writable';
import { z } from 'zod';

interface MyWritableType {
  foo: string;
  bar: number;
}

const myWritableSchema = z.object({
  foo: z.string(),
  bar: z.number(),
});

// myStoredWritable is typed as Writable<MyWritableType>. `myWritableSchema` must match `MyWritableType`.
const myStoredWritable = storedWritable<MyWritableType>('my-writable-key', myWritableSchema, { foo: 'hello', bar: 1234 });

Full Changelog: v0.1.1...v0.1.2

v0.1.1

17 Mar 12:36
fdc49fa
Compare
Choose a tag to compare

Full Changelog: v0.1.0...v0.1.1

v0.1.0

17 Mar 12:23
6eb97be
Compare
Choose a tag to compare