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

Emit & consume events across Hoodie core and plugins #2

Open
inator opened this issue Nov 21, 2016 · 3 comments
Open

Emit & consume events across Hoodie core and plugins #2

inator opened this issue Nov 21, 2016 · 3 comments

Comments

@inator
Copy link

inator commented Nov 21, 2016

This may already be contemplated or even implemented somewhere in the new Hoodie, but while examining hoodie-account-server I noticed that no events are emitted for consumption through plugins like before - or at least not there.

HAPI appears to provide for this:

server.event('test');
server.on('test', (update) => console.log(update));
server.emit('test', 'hello');

This simple event system could also be key in the support of tasks - as taskDb changes could emit events for Hoodie-wide consumption.

Is this consistent with the vision @gr2m?

@gr2m
Copy link
Member

gr2m commented Nov 21, 2016

So far we put events on the server APIs like here: https://github.com/hoodiehq/hoodie-account-server-api/blob/master/README.md#events

@inator
Copy link
Author

inator commented Nov 21, 2016

Is this missing?

admin.accounts.on('add', function (account) {})

@gr2m
Copy link
Member

gr2m commented Nov 21, 2016

here is an example on how hoodie uses the account events itself to hook create / remove the user databases: https://github.com/hoodiehq/hoodie-server/blob/master/index.js#L23-L47 is that what you mean?

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

No branches or pull requests

2 participants