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

hoodie.account.on('change', cb) passes change, not object #6

Open
gr2m opened this issue Jul 22, 2013 · 4 comments
Open

hoodie.account.on('change', cb) passes change, not object #6

gr2m opened this issue Jul 22, 2013 · 4 comments

Comments

@gr2m
Copy link
Contributor

gr2m commented Jul 22, 2013

When a change event gets triggered, the passed object to the callback is the change object, looking like this:

{ seq: 4,
  id: 'org.couchdb.user:user/test',
  changes: [ { rev: '3-29ef38e195df5ab1c501491958d193e4' } ],
  doc: 
   { _rev: '3-29ef38e195df5ab1c501491958d193e4',
     password_scheme: 'pbkdf2',
     iterations: 10000,
     name: undefined,
     type: undefined,
     roles: [],
     ownerHash: '1973192',
     database: 'user/1973192',
     updatedAt: '2013-07-22T19:09:57.471Z',
     createdAt: '2013-07-22T19:09:57.471Z',
     signedUpAt: '2013-07-22T19:09:57.471Z',
     derived_key: '9fc5c8904960ebe4aef9c54f6df1fe850b6cc5ff',
     salt: 'a7411ae5bf83fc40f688848ba30e4340' } }

But I think it should be the object only.

{ _rev: '3-29ef38e195df5ab1c501491958d193e4',
  password_scheme: 'pbkdf2',
  iterations: 10000,
  name: undefined,
  type: undefined,
  roles: [],
  ownerHash: '1973192',
  database: 'user/1973192',
  updatedAt: '2013-07-22T19:09:57.471Z',
  createdAt: '2013-07-22T19:09:57.471Z',
  signedUpAt: '2013-07-22T19:09:57.471Z',
  derived_key: '9fc5c8904960ebe4aef9c54f6df1fe850b6cc5ff',
  salt: 'a7411ae5bf83fc40f688848ba30e4340' } }
@caolan
Copy link
Contributor

caolan commented Jul 23, 2013

Is there any other reason we might want the change object? I guess we don't
need change.deleted since doc._deleted should be set in that case. I wasn't
sure if we used anything else so decided to include it all. Happy to make
it just the doc though.

On 22 July 2013 20:18, Gregor Martynus [email protected] wrote:

When a change event gets triggered, the passed object to the callback is
the change object, looking like this:

{ seq: 4,
id: 'org.couchdb.user:user/test',
changes: [ { rev: '3-29ef38e195df5ab1c501491958d193e4' } ],
doc:
{ _rev: '3-29ef38e195df5ab1c501491958d193e4',
password_scheme: 'pbkdf2',
iterations: 10000,
name: undefined,
type: undefined,
roles: [],
ownerHash: '1973192',
database: 'user/1973192',
updatedAt: '2013-07-22T19:09:57.471Z',
createdAt: '2013-07-22T19:09:57.471Z',
signedUpAt: '2013-07-22T19:09:57.471Z',
derived_key: '9fc5c8904960ebe4aef9c54f6df1fe850b6cc5ff',
salt: 'a7411ae5bf83fc40f688848ba30e4340' } }

But I think it should be the object only.

{ _rev: '3-29ef38e195df5ab1c501491958d193e4',
password_scheme: 'pbkdf2',
iterations: 10000,
name: undefined,
type: undefined,
roles: [],
ownerHash: '1973192',
database: 'user/1973192',
updatedAt: '2013-07-22T19:09:57.471Z',
createdAt: '2013-07-22T19:09:57.471Z',
signedUpAt: '2013-07-22T19:09:57.471Z',
derived_key: '9fc5c8904960ebe4aef9c54f6df1fe850b6cc5ff',
salt: 'a7411ae5bf83fc40f688848ba30e4340' } }


Reply to this email directly or view it on GitHubhttps://github.com//issues/6
.

@gr2m
Copy link
Contributor Author

gr2m commented Jul 23, 2013

I think it's more clear if we pass the object only. It's a CouchDB internal. I'd treat the worker API similar to the frontend API meaning that we hide away internals as much as possible

@gr2m
Copy link
Contributor Author

gr2m commented Aug 2, 2013

so, can we make it that the actual object gets passed, not the change?

@janl
Copy link
Contributor

janl commented Aug 23, 2013

+1

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