Is there a way to run pe:timer with milliseconds than seconds?
I need to run a timer each 100 milliseconds.
Thanks
pe:timer with milliseconds [Solved]
-
- Posts: 4
- Joined: 02 Sep 2014, 20:11
Last edited by marcoszamparo on 30 Jan 2019, 19:47, edited 1 time in total.
Primefaces 6.1
Yes. Add the below JavaScript to your page to override the "start" method of the widget to set the interval to 100 instead of 1000.
Code: Select all
PrimeFaces.widget.ExtTimer.prototype.start = function() {
var that = this;
var end;
this.prevTime = this.currentTimeInSecs();
if(!this.interval){
this.interval = setInterval(function(){
that.doStep();
end = that.forward ? that.currentTimeout >= that.originalTimeout : that.currentTimeout <= 0;
if(end){
if(that.cfg.listener){
that.cfg.listener();
}
if(that.cfg.ontimercomplete){
that.cfg.ontimercomplete();
}
if(that.cfg.singleRun){
clearInterval(that.interval);
this.interval = null;
}else{
that.currentTimeout = that.forward ? 0 : that.originalTimeout;
that.print();
}
}
}, 100);
}
}
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
Nice!!!
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
Just an FYI I added an "interval" attribute to pe:timer for 7.0 so you can configure this as an attribute.
See ticket: https://github.com/primefaces-extension ... issues/645
See ticket: https://github.com/primefaces-extension ... issues/645
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- Information
-
Who is online
Users browsing this forum: No registered users and 18 guests