Is it true that if possible I should never use setInterval & setTimeout?

后端 未结 3 2018
花落未央
花落未央 2021-02-09 10:54

I am learning to code in JavaScript. I am programming something with some timed mouse animation. I\'m just about to add some code which draws the mouse path.

It\'s going

3条回答
  •  执笔经年
    2021-02-09 11:48

    you can use them if you are 100% sure that it is the exact time you need you. if it is an ambiguous situation then not to use it. if you are using a javascript framework look for a lifecycle hooks e.g in angular use Angular life cycle hooks.

提交回复
热议问题