@interface-db/svelte
v1.0.67
Published
Svelte client for InterfaceDB
Readme
@interface-db/svelte
Svelte client for InterfaceDB.
Maintained by InterfaceDB, based on the Instant source. See LICENSE.md and NOTICE for attribution.
Welcome to InterfaceDB’s Svelte SDK.
<!-- ༼ つ ◕_◕ ༽つ Real-time Chat -->
<!-- ---------------------------------- -->
<!-- * Updates instantly -->
<!-- * Multiplayer -->
<!-- * Works offline -->
<script lang="ts">
import { init, id } from '@interface-db/svelte';
const db = init({ appId: import.meta.env.VITE_INSTANT_APP_ID });
// 1. Read
const query = db.useQuery({ messages: {} });
// 2. Write
const addMessage = (message) => {
db.transact(db.tx.messages[id()].update(message));
};
</script>
<!-- 3. Render! -->
<UI data={query.data} onAdd={addMessage} />Get Started
Follow the getting started tutorial to set up a live Svelte app in under 5 minutes!
Questions?
If you have any questions, feel free to drop us a line on our issue tracker
