Giter Club home page Giter Club logo

Comments (5)

techfort avatar techfort commented on June 19, 2024

Yes, this definitely sounds like an attractive feature.

from lokijs.

wxygeek avatar wxygeek commented on June 19, 2024

Maybe I can add a new changeEventEmitter for every collection, and when use Loki, consumers can set their own event function for every change event, just like:

var users = db.addCollection('user');
users.changeEventEmitter.on('insert', function (obj) {
    ***
});
users.changeEventEmitter.on('update', function (obj) {
    ***
});

from lokijs.

techfort avatar techfort commented on June 19, 2024

I have a draft implementation going which is quite similar to what you suggested. This is underway.

from lokijs.

techfort avatar techfort commented on June 19, 2024

1.1 released, closing this.

from lokijs.

dragantl avatar dragantl commented on June 19, 2024

The Changes API currently implemented is a great feature for syncing changes to the db at times when the API is invoked. However, the API does not push/emit any events to possible subscribers. Is this on the table to implement at any point in time? That is, something similar that @wxygeek mentioned in the post above?

There are many scenarios under which this is helpful. If application has a reasonable code separation, certain components that encapsulate collections are not aware of one another. However, actions on one can be performed to affect the other. This can be seen in a simple favoriting feature of something. It would be great to have the ability to sign up and listen for a change event in order to refetch or rerender the data.

from lokijs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.