### Install Svelte Persistent Store Source: https://github.com/macfja/svelte-persistent-store/blob/main/README.md Installs the svelte-persistent-store package using npm. This is the first step to using the library in your Svelte project. ```bash npm install @macfja/svelte-persistent-store ``` -------------------------------- ### Persist Svelte Store with SessionStorage Source: https://github.com/macfja/svelte-persistent-store/blob/main/README.md Shows how to use `persistBrowserSession` to create a Svelte store that persists its value only for the current browser session (using SessionStorage). It includes an example of initializing the store and updating its value. ```javascript import { persistBrowserSession } from "@macfja/svelte-persistent-store" import { writable } from "svelte/store" let title = persistBrowserSession(writable("Unsaved"), "document-name") $title = "My Document" // if you reload the page the value of $title is 'My Document' ``` -------------------------------- ### Run Lint and Test Commands Source: https://github.com/macfja/svelte-persistent-store/blob/main/CONTRIBUTING.md This snippet shows the commands to run for checking code quality and tests within the svelte-persistent-store project. It ensures that the code adheres to project standards and that all tests pass. ```sh npm run lint npm run test ``` -------------------------------- ### Create Persistent Writable Store Source: https://github.com/macfja/svelte-persistent-store/blob/main/README.md Demonstrates creating a persistent writable store directly using the `writable` function from the library, which defaults to LocalStorage. It shows initialization and updating the store's value. ```javascript import { writable } from "@macfja/svelte-persistent-store" // Create a wriatble store, persisted in browser LocalStorage, with the key `name` let name = writable("name", "John") $name = "Jeanne Doe" // if you reload the page the value of $name is 'Jeanne Doe' ``` -------------------------------- ### Persist Svelte Store with LocalStorage Source: https://github.com/macfja/svelte-persistent-store/blob/main/README.md Demonstrates how to use the `persist` function with `createLocalStorage` to create a Svelte store that saves its value to the browser's LocalStorage. It shows how to initialize the store with a default value and how to update it. ```javascript import { persist, createLocalStorage } from "@macfja/svelte-persistent-store" import { writable } from "svelte/store" let name = persist(writable("John"), createLocalStorage(), "name") $name = "Jeanne Doe" // if you reload the page the value of $name is 'Jeanne Doe' ``` -------------------------------- ### Persist Function Signature Source: https://github.com/macfja/svelte-persistent-store/blob/main/README.md Provides the TypeScript type signature for the `persist` function, detailing its parameters: a Svelte writable store, a storage interface implementation, and a key for persistence. It also mentions the addition of a `delete` function to the returned store. ```typescript declare function persist(store: Writable, storage: StorageInterface, key: string): PersistentStore ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.