From eb207f6eb48e18098a61c3d5ee65e56ce1adafb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Fri, 24 Jun 2011 13:43:41 +0200 Subject: [PATCH] Rename memoize to throttle It represents better the purpose of the function. FEA: ItEr75S08MigrationZK5 --- ganttzk/src/main/resources/web/js/common/Common.js | 2 +- ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ganttzk/src/main/resources/web/js/common/Common.js b/ganttzk/src/main/resources/web/js/common/Common.js index d5a063e5c..1528bd802 100644 --- a/ganttzk/src/main/resources/web/js/common/Common.js +++ b/ganttzk/src/main/resources/web/js/common/Common.js @@ -4,7 +4,7 @@ common.Common = zk.$extends(zk.Widget,{},{ webAppContextPath : function(){ return window.location.pathname.split( '/' )[1];}, - memoize: function(timeoutTimeMillis, functionToExecute) { + throttle: function(timeoutTimeMillis, functionToExecute) { var lastTimeCalled = null; var cachedResult = null; return function() { diff --git a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js index 2d6561516..4752e4681 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js +++ b/ganttzk/src/main/resources/web/js/ganttz/TaskComponent.js @@ -117,7 +117,7 @@ ganttz.TaskComponent = zk.$extends(zul.Widget, { _addDragDrop : function(){ var dragdropregion = this._getDragDropRegion(); var thisTaskId = this.$n().id; - var relatedDependencies = common.Common.memoize(3000, function() { + var relatedDependencies = common.Common.throttle(3000, function() { return jq('.dependency[idtaskorig='+ thisTaskId + ']') .add('.dependency[idtaskend='+ thisTaskId + ']') .get() @@ -125,7 +125,7 @@ ganttz.TaskComponent = zk.$extends(zul.Widget, { return ganttz.DependencyComponentBase.$(dep); }); }); - var drawDependencies = common.Common.memoize(25, function() { + var drawDependencies = common.Common.throttle(25, function() { relatedDependencies().forEach(function(dependency) { dependency.draw(); });