You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/06/16 17:25:35 UTC
[2/2] git commit: WICKET-5607 Wicket Ajax fires calls scheduled by
AbstractAjaxTimerBehavior even after unload of the page
WICKET-5607 Wicket Ajax fires calls scheduled by AbstractAjaxTimerBehavior even after unload of the page
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4ffd8f6f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4ffd8f6f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4ffd8f6f
Branch: refs/heads/wicket-6.x
Commit: 4ffd8f6f4986617caf9a4dcf293c9f59daa263a8
Parents: 4a3ee06
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jun 16 18:23:42 2014 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Jun 16 18:23:42 2014 +0300
----------------------------------------------------------------------
.../apache/wicket/ajax/res/js/wicket-ajax-jquery.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4ffd8f6f/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index cff2283..9b638a2 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2806,6 +2806,21 @@
Wicket.Event.add(window, 'domready', Wicket.Focus.attachFocusEvent);
/**
+ * Clear any scheduled Ajax timers when leaving the current page
+ */
+ Wicket.Event.add(window, "beforeunload", function() {
+ var WTH = Wicket.TimerHandles;
+ if (WTH) {
+ for (var th in WTH) {
+ if (WTH.hasOwnProperty(th)) {
+ window.clearTimeout(WTH[th]);
+ delete WTH[th];
+ }
+ }
+ }
+ });
+
+ /**
* Remove any scheduled timers on the removed element.
* This wont remove the timer for elements which are children of the removed one.
*/