From 644d0e78868747a8251f678451e2a3ba6f6c6c6b Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Wed, 22 Apr 2015 20:06:31 -0700 Subject: [PATCH] Update distinction between requestAnimationFrame and setTimeout(fn, 0) --- docs/Timers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Timers.md b/docs/Timers.md index b7cfbb8b0fa3ca..9e652e8cc40a3f 100644 --- a/docs/Timers.md +++ b/docs/Timers.md @@ -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.