From 739eba71bb0ced9d6d97c1d2b00ec00fd8c0e161 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 29 Nov 2014 15:51:31 -0500 Subject: [PATCH] only one router setTimeout function at a time - make it erase old functions if new one --- app/assets/javascripts/src/Metamaps.Views.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.Views.js b/app/assets/javascripts/src/Metamaps.Views.js index b56a599f..00f1b7f6 100644 --- a/app/assets/javascripts/src/Metamaps.Views.js +++ b/app/assets/javascripts/src/Metamaps.Views.js @@ -9,7 +9,7 @@ Metamaps.Views.init = function () { template: Hogan.compile( $('#mapperCardTemplate').html() ), - tagName: "div", + tagNamea: "div", className: "mapper", @@ -92,7 +92,8 @@ Metamaps.Views.init = function () { Metamaps.Loading.hide(); - setTimeout((function(localCurrentPage){ return function(){ + clearTimeout(Metamaps.routerTimeoutFunctionIds); + Metamaps.routerTimeoutId = setTimeout((function(localCurrentPage){ return function(){ var path = (Metamaps.currentSection == "") ? "" : "/explore/" + localCurrentPage; // alter url if for mapper profile page