Skip to content

Commit

Permalink
Update distinction between requestAnimationFrame and setTimeout(fn, 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
sahrens committed Apr 23, 2015
1 parent 76e5439 commit 644d0e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/Timers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Timers are an important part of an application and React Native implements the [
- setImmediate, clearImmediate
- requestAnimationFrame, cancelAnimationFrame

`requestAnimationFrame(fn)` is the exact equivalent of `setTimeout(fn, 0)`, they are triggered right after the screen has been flushed.
`requestAnimationFrame(fn)` is not the same as `setTimeout(fn, 0)` - the former will fire after all the frame has flushed, whereas the latter will fire as quickly as possible (over 1000x per second on a iPhone 5S).

`setImmediate` is executed at the end of the current JavaScript execution block, right before sending the batched response back to native. Note that if you call `setImmediate` within a `setImmediate` callback, it will be executed right away, it won't yield back to native in between.

Expand Down

0 comments on commit 644d0e7

Please sign in to comment.