Etemplate: If countdown time changes, avoid multiple updates / alarms

This commit is contained in:
nathan 2023-08-01 11:20:51 -06:00
parent e19ab7edb2
commit 63e71dc96b

View File

@ -101,6 +101,12 @@ export class et2_countdown extends et2_valueWidget {
if (isNaN(_time)) return; if (isNaN(_time)) return;
super.set_value(_time); super.set_value(_time);
if(this.timer)
{
clearInterval(this.timer);
}
this.time = new Date(); this.time = new Date();
this.time.setSeconds(this.time.getSeconds() + parseInt(_time)); this.time.setSeconds(this.time.getSeconds() + parseInt(_time));