Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes/Stream API #13

Closed
zeroware opened this issue Nov 4, 2014 · 5 comments
Closed

Changes/Stream API #13

zeroware opened this issue Nov 4, 2014 · 5 comments

Comments

@zeroware
Copy link

zeroware commented Nov 4, 2014

Do you plan to add a changes event feature like the CouchDB change API ?

@techfort
Copy link
Owner

techfort commented Nov 4, 2014

Yes, this definitely sounds like an attractive feature.

@techfort techfort added this to the v1.1.0 [Wintar] milestone Nov 8, 2014
@wxygeek
Copy link
Contributor

wxygeek commented Nov 18, 2014

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) {
    ***
});

@techfort
Copy link
Owner

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

@techfort
Copy link
Owner

1.1 released, closing this.

@dragantl
Copy link

dragantl commented Mar 9, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants