From 3dacc8f6839e125f3d464e2a182e7795d815ed11 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 26 Feb 2013 01:14:54 +0100 Subject: [PATCH] Fixed clearDelay(). --- .../controllers/_application_controller.js.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 5ddd2d243..42d76f3c5 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -182,22 +182,22 @@ class App.Controller extends Spine.Controller # check global var if !@_delayID @_delayID = {} - clearTimeout( @_delayID[delay_id] ) if @_delayID[delay_id] delay: (callback, timeout, delay_id) => - # check global var - if !@_delayID - @_delayID = {} - # clear auto save - @clearDelay( @_delayID[delay_id] ) + @clearDelay( delay_id ) # request new data call = => callback() if delay_id + + # check global var + if !@_delayID + @_delayID = {} + @_delayID[delay_id] = setTimeout( call, timeout ) else setTimeout( call, timeout )