Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8184: add_periodicalupdater_max_frequency_for_decay.diff

File add_periodicalupdater_max_frequency_for_decay.diff, 1.0 kB (added by kampers, 1 year ago)
  • src/ajax.js

    old new  
    362362    (this.onComplete || Prototype.emptyFunction).apply(this, arguments); 
    363363  }, 
    364364 
    365   updateComplete: function(responseText) { 
     365  updateComplete: function(response) { 
    366366    if (this.options.decay) { 
    367       this.decay = (responseText == this.lastText ?  
    368         this.decay * this.options.decay : 1); 
    369  
    370       this.lastText = responseText; 
     367      this.frequency = (response.responseText == this.lastText) ? 
     368        this.options.decay * this.frequency : this.options.frequency; 
     369         
     370      if (this.options.maxFrequency && 
     371          this.frequency > this.options.maxFrequency) { 
     372        this.frequency = this.options.maxFrequency; 
     373      } 
     374       
     375      this.lastText = response.responseText; 
    371376    } 
    372     this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); 
     377    this.timer = this.onTimerEvent.bind(this).delay(this.frequency); 
    373378  }, 
    374379 
    375380  onTimerEvent: function() {