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

Added params.backbutton #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ function addListeners(history) {
var options = {
previous: previous
, url: currentPath
, backbutton: true
}

if (state) {
Expand Down
1 change: 1 addition & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@ RenderReq.prototype.routeParams = function(route) {
params.body = this.body
params.query = this.query
params.method = this.method
params.backbutton = this.options.backbutton
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this should have a null check (if this.options)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, perhaps, but it seemed like options would always have a value (an object):

called here
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/router.js#L30
and here:
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L46
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L76
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L217
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L228

But I'm not sure if it's is called from other modules. I quickly checked but couldn't find anything.

Should I add the check? It's ok to me. Not sure what your practice is here (how strict).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to have null checks because it can crash a process if you forget
it. Options are usually optional, so making sure there is a reasonable
response when the options are missing is preferred.

On Thu, Aug 7, 2014 at 11:41 PM, Ilkka Huotari [email protected]
wrote:

In lib/router.js:

@@ -137,5 +137,6 @@ RenderReq.prototype.routeParams = function(route) {
params.body = this.body
params.query = this.query
params.method = this.method

  • params.backbutton = this.options.backbutton

Yes, perhaps, but it seemed like options would always have a value (an
object).

called here
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/router.js#L30
and here:
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L46
https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L76

https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L217

https://github.com/ilkkah/tracks/blob/feature-backbutton/lib/History.js#L228

But I'm not sure if it's is called from other modules. I quickly checked
but couldn't find anything.

Should I add the check? It's ok to me. Not sure what your practice is here
(how strict).


Reply to this email directly or view it on GitHub
https://github.com/derbyjs/tracks/pull/20/files#r15979820.

Ian Johnson - 周彦
http://enja.org

return params
}