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

Implement events #35

Closed
3 tasks
gr2m opened this issue Dec 23, 2015 · 6 comments
Closed
3 tasks

Implement events #35

gr2m opened this issue Dec 23, 2015 · 6 comments

Comments

@gr2m
Copy link
Member

gr2m commented Dec 23, 2015

  • api.accounts events
  • api.sessions events
  • api.requests events
@gr2m gr2m self-assigned this Dec 23, 2015
@gr2m gr2m removed their assignment Mar 18, 2016
@stephenjfox
Copy link
Contributor

Can I get a little more description on what these desired "events" are? I've got the downtime to figure it out

@gr2m
Copy link
Member Author

gr2m commented Mar 23, 2016

Hey @stevemasta34, these events are about the account JavaScript API that we use within the route handlers, but also expose at server.plugins.account.api. You can see the full documentation at https://github.com/hoodiehq/hoodie-account-server-api/blob/master/README.md, the events are described here: https://github.com/hoodiehq/hoodie-account-server-api/blob/master/README.md#events

We can start with the api.accounts events, everything should be in place to make them work. Sessions are blocked because we currently do not persist them, we could only trigger an "add" event. Requests are also not persisted yet, but we plan to implement that soon.

So, what we’d want to do here is to use PouchDB’s changes feed to emit add, update or remove events, which also always trigger a change event. The API should look like this

api.accounts.on('add', function(account) {})
api.accounts.on('update', function(account) {})
api.accounts.on('remove', function(account) {})
api.accounts.on('change', function(eventName, account) {})

Makes sense?

@stephenjfox
Copy link
Contributor

Yes this make a lot of sense. I'll start a local branch, and if I get any headway (or stuck) I'll start the PR.

@janl
Copy link
Member

janl commented Apr 6, 2016

Heya @stevemasta34: did you get anywhere with this?

If wanna share some in-progess work, I‘d be happy to help :)

@stephenjfox
Copy link
Contributor

Hey @janl my work life has kind of taken over my personal life, so my progress has been minimal; my free time disappeared. You're more than welcome to take the lead on this one, and I'll tag in this weekend.

@gr2m
Copy link
Member Author

gr2m commented Oct 16, 2016

@gr2m gr2m closed this as completed Oct 16, 2016
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

3 participants