From 0d47d7291014dfb0dc9e31457f54e3bd7843fd97 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 7 Apr 2011 16:40:57 -0400 Subject: [PATCH] add .clear_timer method to this setTimeout wrapper --- Open-ILS/xul/staff_client/chrome/content/util/exec.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/exec.js b/Open-ILS/xul/staff_client/chrome/content/util/exec.js index 38f0ca3149..18e7d1ec0d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/exec.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/exec.js @@ -22,10 +22,7 @@ util.exec.prototype = { 'timer' : function(funcs,interval) { var obj = this; - if (obj._intervalId) { - obj.clear_timer(); - window.removeEventListener('unload',obj.clear_timer,false); - } + obj.clear_timer(); var intervalId = window.setInterval( function() { if (typeof obj.debug != 'undefined' && obj.debug) { dump('EXEC: ' + location.pathname + ': Running interval with id = ' + intervalId + '\n'); } @@ -40,6 +37,13 @@ util.exec.prototype = { window.addEventListener('unload',obj.clear_timer,false); return intervalId; }, + 'clear_timer' : function() { + var obj = this; + if (obj._intervalId) { + obj.clear_timer(); + window.removeEventListener('unload',obj.clear_timer,false); + } + }, // This executes a series of functions, but tries to give other events/functions a chance to // execute between each one. 'chain' : function () { -- 2.11.0