Skip to content

Instantly share code, notes, and snippets.

@carlos-aguayo
Last active October 9, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlos-aguayo/3522213 to your computer and use it in GitHub Desktop.
Save carlos-aguayo/3522213 to your computer and use it in GitHub Desktop.
private native void pushState(String url) /*-{
url += $wnd.location.search;
$wnd.history.pushState(null, $doc.title, url);
}-*/;
private native void replaceState(String url) /*-{
url += $wnd.location.search;
$wnd.history.replaceState(null, $doc.title, url);
}-*/;
@Override
protected native void addHistoryEventHandler() /*-{
var that = this;
var oldHandler = $wnd.onpopstate;
$wnd.onpopstate = $entry(function(e) {
that.@com.dreamskiale.client.history.CustomHistorian::onHistoryChange()();
if (oldHandler) {
oldHandler();
}
});
}-*/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment