Monday, October 19, 2020

Re: GWT history with push state

JSNI is deprecated, you can use the browser state API with pushState.
You can also check domino-history which a lightweight wrapper around the pushState.

On Friday, October 16, 2020 at 7:40:39 AM UTC+3 Craig Mitchell wrote:
As Tomas said, not directly with History.  It's simple JSNI though:

public static native void updateURL(String newUrl) /*-{
    $wnd.history.pushState(newUrl, "", newUrl);
}-*/;

public static native void initialise() /*-{
$wnd.onpopstate = $entry(function(e) {
@com.blah.YourClass::yourMethodThatListensForUrlChange()();
});
}-*/;

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/b62e5e0c-3514-417e-a2d1-9253701e20efn%40googlegroups.com.

No comments:

Post a Comment