@curi/svelte

Installation

The package can be installed through npm (you need to have Node & NPM installed).

npm install @curi/svelte

About

This package enables you to use Curi alongside Svelte. This package relies on the Svelte store.

For more information on using Curi with Svelte, please check out the Svelte guide.

API

curiStore

@curi/svelte components rely on being able to access router related values (router, response, and navigation) from a Svelte store. While you can set this up manually, the curiStore will handle this for you.

This will setup an observer to automatically update the store when new responses are emitted by the router.

import { curiStore } from '@curi/svelte';

const router = curi(history, routes);
const store = curiStore(router);

If you already have a store, you can pass it to curiStore and the Curi values will be added to it.

import { curiStore } from '@curi/svelte';
import { Store } from 'svelte/store';

const router = curi(history, routes);
const store = new Store({...});
curiStore(router, store);