samuk190 / localbase

A Firebase-Style Database ... Offline!
636 stars 84 forks source link

Add support for reactivity #62

Closed Rednas83 closed 3 months ago

Rednas83 commented 2 years ago

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>
samuk190 commented 3 months ago

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.