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

@@ -85,4 +85,10 @@ typedef void (^RCTJavaScriptCallback)(id json, NSError *error);
*/
- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block;
/**
* For executors that support it, this method can be used to add a synchronous
* callback function for communicating with the javascript context.
*/
- (void)addSynchronousHookWithName:(NSString *)name usingBlock:(id)block;
@end