react-countdown
react-countdown copied to clipboard
Invoke oncomplete if date has passed
As discussed in #169, it could be helpful to invoke the onComplete
callback if the provided date has passed by the time the Countdown
component has been initialized. Per @ndresx's suggestion in the mentioned issue, the callback is now being invoked with a second argument to specify whether this is the case or not.
Please let me know if you have any feedback; I'll be happy to amend the code.
Coverage remained the same at 100.0% when pulling 4bca3e88160e668d76fd4c55cf21e7da0b78209c on bendikjohansen:invoke-oncomplete-if-date-is-passed into a7185be64596dac04d3b31fe25f59ff6c6b1d1ce on ndresx:master.
Thank you for the feedback!
That sounds like a good idea. I was worried about having to change the countdown status of the component so it isn't stuck in started even though onComplete
has been invoked. Do you have any thoughts about this?
I'm having some issues with running the nested example project and the linting script, but the tests seem to run fine. I'll push the changes once I figure this out :-)
@bendikjohansen It has been a while since you proposed this change; sorry for not responding sooner. I've made more changes to it and finally got to merge it.
Thank you for taking the time to work on this. Have a nice day!
This was actually a breaking change, as before this change onComplete
also supported being passed a type () => Promise<void>
, which is no longer the case.
@stefanofa This should be possible again with https://github.com/ndresx/react-countdown/releases/tag/v2.3.5.