All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flowlogix.web.mixins.DeferUpdate.js Maven / Gradle / Ivy

There is a newer version: 4.0.9
Show newest version
/** 
 * Triggers a zone update after a timer expires
 */

var DeferUpdate = Class.create();
DeferUpdate.prototype = {
    initialize: function(zoneId) {
        this.zoneId = zoneId;
        this.handler = this.doDefer.bindAsEventListener(this);
        Event.observe($(zoneId), Tapestry.ZONE_UPDATED_EVENT,
            this.handler);
    },
		
    doDefer: function() {
        if($(this.zoneId).PeriodicUpdater.numUpdates == 0)
        {
            $(this.zoneId).PeriodicUpdater.stop();
            $(this.zoneId).PeriodicUpdater.start(true);                            
        }
        else
        {
            $(this.zoneId).PeriodicUpdater.numUpdates = 0;
        }
    }
};


// Extend the Tapestry.Initializer with a static method that instantiates us
Tapestry.Initializer.deferUpdate = function(zoneId) {
    new DeferUpdate(zoneId);
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy