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/871cf7d2 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/871cf7d2 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/871cf7d2 Branch: refs/heads/master Commit: 871cf7d279a764c5192d5c61a4d8aff9ec8e5e2f Parents: db92a09 Author: Sven Meier <[email protected]> Authored: Wed Jan 24 19:46:27 2018 +0100 Committer: Sven Meier <[email protected]> Committed: Tue Feb 6 16:20:11 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/871cf7d2/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/871cf7d2/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); }); });
