albert-gonzalez/easytimer.js

custom time

Marcusjnr opened this issue · 7 comments

how many minutes is minutesUpdated and can a custom minute or time replace minutesUpdated

Hi!

minutesUpdate is called every time minutes change (every 60 seconds). You can not replace the time needed to call minutesUpdates.

Best regards!

okay, is there anyway to add a custom time please?

The only way you could do that is set the target property with the desired time and add an event listener to targetAchieved event. If you need the listener to be repeated, you can restart the timer everytime the target is achieved.

Best regards!

alright, thanks

So i followed your advice and did this
` autoBidTimer.start({precision: 'seconds', startValues:{seconds: 0}, target: {seconds: 10}})

    autoBidTimer.addEventListener('secondsUpdated', async function (e) {
        console.log(autoBidTimer.getTimeValues().toString())
    })

    autoBidTimer.addEventListener('targetAchieved', async function (e) {
        autoBidTimer.stop();
        autoBidTimer.start({precision: 'seconds', startValues: {seconds:0}, target: {seconds: 10}})
    })`

But the timer does not restart

Hi!

I've written this fiddle with an example, hope it helps!

https://jsfiddle.net/0rbvmuzf/

Best regards!

Thanks for the response, it really helped. Got busy forgot to close, sorry