If I don't know the return value of setInterval()
or setTimeOut()
, can I still use clearInterveral(id)
or clearTimeOut(id)
to clear them?
Thanks.
If I don't know the return value of setInterval()
or setTimeOut()
, can I still use clearInterveral(id)
or clearTimeOut(id)
to clear them?
Thanks.
You can use a register pattern based object for this.
As far as I know, this is not possible without the original id, so storing that, maybe in an array would be a good idea
You can replace original both setTimeout and setInterval like:
And now:
Suggesting a commentary from @PointedEars you shouldn't use the same name so:
and so on..