nafg / reactive

A simple FRP library and a web UI framework built on it
Other
215 stars 39 forks source link

Browser history #17

Open nafg opened 13 years ago

fmpwizard commented 13 years ago

This would be awesome! Do you have any plans on how to implement it? After I did my prototype for lift I found out there is also a HTML5 history api on most current browsers

nafg commented 13 years ago

On Thu, Aug 11, 2011 at 9:14 PM, fmpwizard < reply@reply.github.com>wrote:

This would be awesome!

Who do you think gave me the idea? ;)

Do you have any plans on how to implement it?

Not too specific.

After I did my prototype for lift I found out there is also a HTML5 history api on most current browsers

Reply to this email directly or view it on GitHub: https://github.com/nafg/reactive/issues/17#issuecomment-1787454

fmpwizard commented 13 years ago

I hope to have some time in the coming weeks to look over at the demo I did using Lift and I'll try to reduce the manual JavaScript I wrote and see what comes out.

nafg commented 9 years ago

I finally had a need to do some history integration. It's actually not too bad, especially with the (recently merged) JsInterpolator:

    for(state <- signal.change) {
      val newUrl = constructUrl(state)
      page.queue(js"""history.pushState($state, "", $newUrl)""")
    }
    def popState(state: State) = signal ()= state
    page.queue(js"""window.onpopstate = function(event) { ${popState _}(event.state)""")

@fmpwizard better late than never :)

I think this sort of obviates the need for a built-in feature, but I'm open to input.

nafg commented 9 years ago

(I'm using reactive-routing for associating a "State" with a reversible route, as well)