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

Add save event #145

Closed
no-more opened this issue Sep 7, 2016 · 4 comments
Closed

Add save event #145

no-more opened this issue Sep 7, 2016 · 4 comments

Comments

@no-more
Copy link

no-more commented Sep 7, 2016

Hi,

It would be great to have a saved event when the collection is persisted on disk.

@Irrelon
Copy link
Owner

Irrelon commented Sep 7, 2016

Can do!

Irrelon added a commit that referenced this issue Sep 7, 2016
@Irrelon
Copy link
Owner

Irrelon commented Sep 7, 2016

Would you mind checking out the dev branch and tell me if this is doing what you need now? The event will emit from both a collection and the underlying db instance the collection is assigned to.

Events are: 'save' and 'load' e.g.

var fdb = new ForerunnerDB(),
    db = fdb.db('test'),
    coll = db.collection('testCollection');

db.on('load', function () {
    // Do something on ANY collection load
});

db.on('save', function () {
    // Do something on ANY collection save
});

coll.on('load', function () {
    // Do something on ONLY THIS collection load
});

coll.on('save', function () {
    // Do something on ONLY THIS collection save
});

@no-more
Copy link
Author

no-more commented Sep 8, 2016

Hi,

Thanks a lot, I'll try to check this today.

@no-more
Copy link
Author

no-more commented Sep 8, 2016

Hi,

Save and load events are working !

Thanks.

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

2 participants