-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fixes #148 - Extra arg on Kinto#collection to replace Collection#use. #149
Fixes #148 - Extra arg on Kinto#collection to replace Collection#use. #149
Conversation
c2473af
to
522a340
Compare
@n1k0 maybe you prefer: coll.configure({
transformers: {
remote: [ myRemoteTransformer ]
}
}); instead of: coll.configure({
remoteTransformers: [ myRemoteTransformer ]
}); |
522a340
to
9c0d43f
Compare
The second version is fine, the first is quite verbose and not much more explicit. |
} | ||
if (config.remoteTransformers instanceof Array) { | ||
this._transformers.remote = config.remoteTransformers; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably raise instead of silently ignoring the passed value here.
9c0d43f
to
16f7fd0
Compare
I went for r? @n1k0 |
@@ -412,7 +412,7 @@ Transformers are basically hooks for encoding and decoding records, which can wo | |||
|
|||
### Remote transformers | |||
|
|||
Remote transformers aim at encoding records before pushing them to the remote server, and decoding them back when pulling changes. Remote transformers are registered by calling the `Collection#use()` method, which accepts a `Kinto.transformers.RemoteTransformer`-derived object instance: | |||
Remote transformers aim at encoding records before pushing them to the remote server, and decoding them back when pulling changes. Remote transformers are registered through the optional second argument of `Kinto#collection()`, which accepts `Kinto.transformers.RemoteTransformer`-derived object instances in its remoteTransformers array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remoteTransformers
(backticks)
This is shaping good, I like the way we explicitly declare the transformers we plan to use for a given collection as soon as we retrieve an instance of it; some small concerns with the tests which are deviating a little from the general adopted strategy. Hope my comments help here, though feel free to reach out for help if needed :) Thanks a bunch! |
Thanks for the detailed feedback, will improve the structure of the tests! |
8571fad
to
5799e68
Compare
Coverage increased (+0.4%) to 100.0% \o/ :) |
@n1k0 wrote:
OK, that would simplify the code further. I think most apps will cache their constructed collections anyway (at least the Sync app does). |
b62020e
to
3d19585
Compare
r? @n1k0 |
@@ -412,7 +412,7 @@ Transformers are basically hooks for encoding and decoding records, which can wo | |||
|
|||
### Remote transformers | |||
|
|||
Remote transformers aim at encoding records before pushing them to the remote server, and decoding them back when pulling changes. Remote transformers are registered by calling the `Collection#use()` method, which accepts a `Kinto.transformers.RemoteTransformer`-derived object instance: | |||
Remote transformers aim at encoding records before pushing them to the remote server, and decoding them back when pulling changes. Remote transformers are registered through the optional second argument of `Kinto#collection()`, which accepts `Kinto.transformers.RemoteTransformer`-derived object instances in its `remoteTransformers` array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add a first-level Plugins heading and describe their underlying concept.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch this comment; as per IRC discussion, options
would be more consistent.
@michielbdejong r=r+wc |
9c06f4e
to
dbfdd58
Compare
Rebased and squashed. |
dbfdd58
to
3468b0e
Compare
Fixes #148 - Extra arg on Kinto#collection to replace Collection#use.
Thanks for all your help with this!! |
No description provided.