Allow setting `history.state`
tmeasday opened this issue · 5 comments
Not sure if you agree with the name @cmather -- I'll use this to set the last known scroll position in an onScroll
handler.
@cmather -- please review the commits attached to the various tickets when you have a sec.
Ok will do
On Sep 16, 2014, at 6:28 PM, Tom Coleman notifications@github.com wrote:
@cmather -- please review the commits attached to the various tickets when you have a sec.
—
Reply to this email directly or view it on GitHub.
@cmather - here's a small proto-package that achieves the scroll saving in the way we talked about: https://github.com/tmeasday/iron-scroll. See the example for very basic usage. Probably a IR onRun
hook would make sense too. Let me know if anything I'm doing here doesn't make sense.
A problem with this is that it forces a redispatch of the router every time you change history.state
, which is unlikely to be what you want.
This works but the issues remaining are:
- Where should it go? Right now it's
Location.get().options.historyState
which is pretty ugly. - We need to update IR to call out to it rather than always
Location.go()
. Not sure if this meansLocation.go()
should take{replaceState}
as a param, or IR should choose betweenLocation.go()
andLocation.replaceState()
. [https://github.com//issues/5] - If you change the state outside of routing, you probably don't want the router to re-dispatch. Not sure what the cleanest way to allow this is. See also iron-meteor/iron-router#893 for the equivalent thing when changing hash frag.