Mit Ajax.PeriodicalUpdater nur updaten wenn Content verändert wurde

Geschrieben von ckay am 16. Juli 2009 | Abgelegt unter Tipps

Die Funktion Ajax.PeriodicalUpdater aus der Prototype-Bibliothek ist ja ansich schon eine feine Sache. Das einzige was immer störte war, dass der Inhalt auch aktualisiert wurde wenn der Content sich nicht geändert hat.
Auf der Suche nach einer Lösung habe ich dann diese nette Erweiterung für Prototype gefunden:

Murder at 1600 download

Angel Blade psp

Heartbreakers ipod

Ajax.PassivePeriodicalUpdater = Class.create(Ajax.Base, {
initialize: function($super, container, url, options) {
$super(options);

The Longest Day dvdrip

Confessions of a Pop Performer download this.onComplete = this.options.onComplete;

this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);

Show Stoppers hd

this.updater = { };
this.container = $(container);
this.url = url;

Brainscan this.start();
Laughing Gas psp
},

100 Tears buy

start: function() {
this.options.onComplete = this.updateComplete.bind(this);
this.onTimerEvent();
},

Enchanted film

Taking 5 movie stop: function() {
this.updater.options.onComplete = undefined;

clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},

updateComplete: function(response) {
if (response.responseText == this.lastText) {
this.decay = this.decay * this.options.decay;
} else {
this.decay = 1;
this.container.update(response.responseText);
this.lastText = response.responseText;

Blue Collar move The Bliss ipod

Bloody Sunday move Hellraiser: Bloodline hd

}
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
},

onTimerEvent: function() {
this.updater = new Ajax.Request(this.url, this.options);

}
});

The World Is Not Enough ipod Quelle: hier

Girl’s Best Friend dvd

Trackback URI | Kommentare als RSS

Einen Kommentar schreiben

Twitter Users
Enter your personal information in the form or sign in with your Twitter account by clicking the button below.