Svelte Framework
If you're using the Svelte framework to develop your app, ensure your ditto instance remains accessible throughout your app by using the writable function from the top-most scope of your app:
- From the top-most scope of your app, import Ditto.
- Using async await, initialize Ditto.
- Provide your access credentials:
- Replace the appID placeholder value with the app ID that identifies your app in Ditto.
- Replace the token placeholder value with your playground token that the Big Peer uses to verify your digital identity before issuing your playground certificate.
import { writable } from "svelte/store";
let ditto = writable([]);
let subscription = writable([]);
ditto.set(new Ditto(identity))
subscription.set($ditto.store.collections("cars").find("color == 'red'").subscribe())