JavaScript's version of ActionScript's Event.ENTER_FRAME event?

前端 未结 5 1472
别那么骄傲
别那么骄傲 2021-01-03 05:42

I am trying to learn JavaScript and I am wondering whether JavaScript has a event listener just like ActionScript\'s ENTER_FRAME. Basically, I want this event listener to li

5条回答
  •  粉色の甜心
    2021-01-03 05:59

    Nope. Not really. A good substitute would be setInterval or setTimeout:

    function doAllTheTime() { }
    function wrapper() {
        doAllTheTime();
        setTimeout(wrapper, 40);
    }
    wrapper();
    

    But even then, you're pretty limited, because you don't have access to any of the event object properties.

提交回复
热议问题