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

Ticket #8184: periodical-updater-frequency-min.patch

File periodical-updater-frequency-min.patch, 0.8 kB (added by zerodeux, 1 year ago)
  • trunk/src/ajax.js

    old new  
    342342    this.onComplete = this.options.onComplete; 
    343343 
    344344    this.frequency = (this.options.frequency || 2); 
     345    this.frequencyMin = (this.options.frequencyMin || 0); 
    345346    this.decay = (this.options.decay || 1); 
    346347     
    347348    this.updater = { }; 
     
    369370 
    370371      this.lastText = response.responseText; 
    371372    } 
    372     this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); 
     373    var frequency = this.decay * this.frequency; 
     374    if (this.frequencyMin && period > this.frequencyMin) 
     375      period = this.frequencyMin; 
     376    this.timer = this.onTimerEvent.bind(this).delay(frequency); 
    373377  }, 
    374378 
    375379  onTimerEvent: function() {