samuk190 / localbase

A Firebase-Style Database ... Offline!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for reactivity

Rednas83 opened this issue · comments

Good work on this library!

Do you also have plans for reactivity?

Something like (example from 'dexie' for the 'vue3' framework)

<template>
  <ul>
    <li v-for="friend in friends" :key="friend.id">
      {{ friend.name }}, {{ item.age }}
    </li>
  </ul>
</template>

<script>
  import { liveQuery } from "dexie";
  import { useObservable } from "@vueuse/rxjs";
  import { db } from "./db";

  export default {
    name: "FriendList",
    setup() {
      return {
        db,
        items: useObservable(
          liveQuery(() => db.friends.toArray())
        ),
      };
    },
  };
</script>

I'll be closing this issue as it is old and not planned on next release, but if someone have an idea of implementation please make an Pull Request.