You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2018/01/26 23:04:21 UTC

[16/16] wicket git commit: WICKET-6523 restarting should re-set the timeout

WICKET-6523 restarting should re-set the timeout


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/15aa06f4
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/15aa06f4
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/15aa06f4

Branch: refs/heads/WICKET-6523-ajax-timers
Commit: 15aa06f47b2230a4fbe8b6aed6bf731e68968ac8
Parents: 36bf207
Author: Sven Meier <sv...@apache.org>
Authored: Wed Jan 24 19:46:27 2018 +0100
Committer: Sven Meier <sv...@apache.org>
Committed: Sat Jan 27 00:02:58 2018 +0100

----------------------------------------------------------------------
 .../apache/wicket/ajax/AbstractAjaxTimerBehavior.java  | 13 +++++--------
 wicket-core/src/test/js/timer.js                       |  4 +++-
 2 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/15aa06f4/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
index 25dd1b7..d193691 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
@@ -154,21 +154,18 @@ public abstract class AbstractAjaxTimerBehavior extends AbstractDefaultAjaxBehav
 	}
 
 	/**
-	 * Re-enables the timer if already stopped
+	 * Restart the timer.
 	 * 
 	 * @param target
 	 *            may be null
 	 */
 	public final void restart(final IPartialPageRequestHandler target)
 	{
-		if (stopped == true)
-		{
-			stopped = false;
+		stopped = false;
 
-			if (target != null)
-			{
-				setTimeout(target.getHeaderResponse());
-			}
+		if (target != null)
+		{
+			setTimeout(target.getHeaderResponse());
 		}
 	}
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/15aa06f4/wicket-core/src/test/js/timer.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/js/timer.js b/wicket-core/src/test/js/timer.js
index c95c20b..48efdaa 100644
--- a/wicket-core/src/test/js/timer.js
+++ b/wicket-core/src/test/js/timer.js
@@ -51,6 +51,8 @@ jQuery(document).ready(function() {
 		Wicket.Timer.clear(timerId);
 		ok(typeof(Wicket.TimerHandles[timerId]) === 'undefined', "There is no handle to the timeout!");
 
-		start();
+		setTimeout(function() {
+			start();			
+		}, 2);
 	});
 });