0.1.22 • Published 8 months ago

@dorilama/instantdb-vue v0.1.22

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

instantdb-vue

Unofficial port of @instantdb/react for vue

// ༼ つ ◕_◕ ༽つ Real-time Chat
// ----------------------------------
// * Updates instantly
// * Multiplayer
// * Works offline
<script setup>
import { init, tx, id } from "@dorilama/instantdb-vue";
import { Cursors } from "@dorilama/instantdb-vue/components";

const db = init({ appId: "my-app-id" });
// 1. Read
const { isLoading, error, data } = db.useQuery({
  messages: {},
});
const room = db.room("chat", "main");

// 2. Write
const addMessage = (message) => {
  db.transact(tx.messages[id()].update(message));
};
</script>
<template>
  <!-- 3. Render! -->
  <Cursors :room="room">
    <UI :data="data" @add="addMessage" />
  </Cursors>
</template>

The aim of this library is to have @instantdb/react for vue with feature parity. You should be able to follow the react docs and examples using this library. Arguments are reactive so you can use refs or getters. Cursors component has a separate import from @dorilama/instantdb-vue/components. Some of the functions return also a stop function to manually clear all side-effects and break live updated.


Related: this library tries to bring the same sdk for multiple signal based reactivity.

0.1.21

8 months ago

0.1.22

8 months ago

0.1.20

8 months ago

0.1.17

8 months ago

0.1.18

8 months ago

0.1.19

8 months ago

0.1.16

8 months ago

0.1.15

8 months ago

0.1.14

8 months ago

0.1.13

8 months ago

0.1.12

8 months ago

0.1.11

9 months ago

0.1.10

9 months ago

0.1.9

9 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago