Conversation
lib/index.js
Outdated
There was a problem hiding this comment.
What happens if this._context is a function?
There was a problem hiding this comment.
Not supported in this form. I wasn't able to find a good way to make this work with the examples using the request argument.
|
I think maybe if they pass a function for the global context, it shouldn't take any parameters, that way it isn't limited to where it's used. If they need something from the request, they'll have it "on hand" when they call |
|
Agreed, that will simplify things a bit. Will update accordingly. Thanks for the feedback! |
579c9af to
c633aa7
Compare
|
Better? |
|
So I noticed your tests pass |
|
Sure. If I understand correctly, that only applies to the |
|
Anywhere were you have access to like the query string or route params. I think that's probably only in |
|
This seems consistent with what I saw in the existing code/tests. |
|
@jagoda somewhere where you do You'll want to inject a request with a query string and not pass a |
|
Yup, understood. I believe I did that here. Sorry if it was unclear that I added a new commit with my previous comment. |
|
Thanks @jagoda! |
|
@jagoda The "Global context" section in the view tutorial should be updated too: http://hapijs.com/tutorials/views#global-context |
|
Should hold off on any documentation updates until the new version is published AND hapi uses it. |
There was a problem hiding this comment.
This block should be a single line statement.
var defaultContext = (this._context ? (typeof this._context === 'function' ? this._context() : Hoek.clone(this._context)) : {});There was a problem hiding this comment.
OK. Is there something in the style guide that I missed that applies to this?
There was a problem hiding this comment.
Nope. just cleaner and most consistent.
|
@arb no problem. I'm happy to help with documentation when the time comes. @hueniverse I opened #7 to address the style issues. |
|
Feel free to open a PR on hapi with the updated doc and detailed change in the issue notes. The PR should include the change to package.json as well as npm-shrinkwrap.json. |
|
I'd be happy to help with the PR on Hapi once 1.2.0 is published. |
|
I need to fix master to remove the hapi 8 stuff I got in there by accident... |
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Closes #4