# @ldo/svelte ## Installation ``` npm i @ldo/svelte @ldo/solid ``` ## Usage (see the "example" folder for a full example) Initialize your LDO methods ```typescript import { createLdoSvelteMethods } from "@ldo/svelte"; import { solidConnectedPlugin } from "@ldo/connected-solid"; export const { dataset, useLdo, useMatchObject, useMatchSubject, useResource, useSubject, useSubscribeToResource, useLinkQuery, } = createLdoSvelteMethods([solidConnectedPlugin]); // At some point when you log in, you'll need to set context on the dataset with // the authentication information. For example, in Solid, you would run: // dataset.setContext("solid", { fetch: authFetch }); ``` Use them in your svelte components ```svelte

LDO Svelte Support Demo

{#if $resource.isLoading() || !$profile}

loading

{:else}
{#if firstFriendId}

{firstFriendId}

{:else}

No friend found or friend has no @id.

{/if}
{/if} ```