[ReactNative] Properly pause frame update observers when idle

Summary:
@public

`RCTDispatchEvent` and `RCTTiming` weren't being paused when there wasn't any
work left to be done.

Test Plan:
Run the timers example - check everything still works as expected
Test the ListView paging example - check scroll events are still fired as expected
Launch UIExplorer, let it idle, and put a break point on `-[RCTBridge dispatchBlock:moduleID:]`,
it should never fire.
This commit is contained in:
Tadeu Zagallo
2015-06-07 08:42:31 -07:00
parent 8ee9bfe944
commit c2fb21b322
2 changed files with 7 additions and 0 deletions

View File

@@ -155,6 +155,10 @@ RCT_IMPORT_METHOD(RCTJSTimers, callTimers)
if ([timersToCall count] > 0) {
[_bridge enqueueJSCall:@"RCTJSTimers.callTimers" args:@[timersToCall]];
}
if (_timers.count == 0) {
[self stopTimers];
}
}
/**