Add context executor API for sync hooks

Summary:
public

This exposes a proper API for adding synchronous callbacks to JS, as an optional feature of the executor.

This is based on nicklockwood's work in D2764492, but avoids refactoring bridge/executor interactions for the time being, since we agree on this API and can move the actual callsites around later.

Reviewed By: nicklockwood

Differential Revision: D2799506

fb-gh-sync-id: af209d9a0be927f3404205feb16e59745cc37aec
This commit is contained in:
Justin Spahr-Summers
2016-01-05 07:59:54 -08:00
committed by facebook-github-bot-7
parent 1c1d7006c2
commit a5d82c2823
4 changed files with 103 additions and 83 deletions

View File

@@ -187,7 +187,7 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
moduleProvider:nil
launchOptions:nil];
id executor = [bridge.batchedBridge valueForKey:@"javaScriptExecutor"];
RUN_RUNLOOP_WHILE(!(weakContext = [executor valueForKey:@"context"]));
RUN_RUNLOOP_WHILE(!(weakContext = [executor valueForKey:@"_context"]));
XCTAssertNotNil(weakContext, @"RCTJavaScriptContext should have been created");
(void)bridge;
}