META-INF.resources.primefaces.effect.effect.js Maven / Gradle / Ivy
/**
* PrimeFaces Effect Widget
*/
PrimeFaces.widget.Effect = PrimeFaces.widget.BaseWidget.extend({
init: function(cfg) {
this.cfg = cfg;
this.id = this.cfg.id;
this.jqId = PrimeFaces.escapeClientId(this.id);
this.source = $(PrimeFaces.escapeClientId(this.cfg.source));
var _self = this;
this.runner = function() {
//avoid queuing multiple runs
if(_self.timeoutId) {
clearTimeout(_self.timeoutId);
}
_self.timeoutId = setTimeout(_self.cfg.fn, _self.cfg.delay);
};
if(this.cfg.event == 'load') {
this.runner.call();
}
else {
this.source.bind(this.cfg.event, this.runner);
}
this.removeScriptElement(this.id);
}
});