Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prevent another page transition when there is already one ongoing.

  • Loading branch information...
commit 4c95a668361be0e04b974e87da3d2d3953ec57cc 1 parent 7f70dbc
@dennisjzh authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/com/gwtmobile/ui/client/page/Page.java
View
10 src/com/gwtmobile/ui/client/page/Page.java
@@ -35,6 +35,7 @@
private Transition _transition;
private static Transition _defaultTransition = Transition.SLIDE;
protected String tokenStateInfo = CONSUMED_TOKEN;
+ protected static boolean inTransition = false;
static {
if (!Utils.isDesktop() && !Utils.hasPhoneGap()) {
@@ -133,6 +134,7 @@ public void run() {
};
timer.schedule(1);
}
+ inTransition = false;
}
protected void initNavigationIfRequired() {
@@ -149,6 +151,10 @@ protected void onNavigateBack(Page from, Object object) {
}
public void goTo(final Page toPage, final Transition transition) {
+ if (inTransition) {
+ return;//can't start a new page transition until last one is complete.
+ }
+ inTransition = true;
Element focus = Utils.getActiveElement();
focus.blur();
final Page fromPage = this;
@@ -161,6 +167,10 @@ public void goTo(final Page toPage, final Transition transition) {
}
public void goBack(Object returnValue) {
+ if (inTransition) {
+ return;//can't start a new page transition until last one is complete.
+ }
+ inTransition = true;
PageHistory.Instance.goBack(this, returnValue);
}
Please sign in to comment.
Something went wrong with that request. Please try again.