哈哈:)我的codepen 的代码笔记是:http://codepen.io/shinewaker/pen/eBwPxJ
-------------------------------------------------------
I mean, check it out this code :
as you can see in console, the "animate" function is Asynchronous, and it "fork" the flow of the event handler block code. In fact :
follow the flow of the block code! If I wish to create my |
You cannot make a truly custom asynchronous function. You'll eventually have to leverage on a technology provided natively, such as:
setInterval
setTimeout
requestAnimationFrame
XMLHttpRequest
WebSocket
Worker
- Some HTML5 APIs such as the File API, Web Database API
- Technologies that support
onload
- ... many others
In fact, for the animation jQuery uses setInterval
.