Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Loader] define RCTBridgeDelegate and delegate JS loading to it #1681

Closed
ide opened this issue Jun 19, 2015 · 6 comments
Closed

[Loader] define RCTBridgeDelegate and delegate JS loading to it #1681

ide opened this issue Jun 19, 2015 · 6 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ide
Copy link
Contributor

ide commented Jun 19, 2015

hey @tadeuzagallo - I would like to be able to control the JS loading process myself so that I can handle errors differently and implement other custom behavior. Do you have plans to do this or would you accept a PR that makes this change? The idea I have is to add a delegate to the bridge called RCTBridgeDelegate. It would look like this:

@protocol RCTBridgeDelegate
@optional
- (void)loadJavaScriptAtURL:(NSURL *)URL
                 onComplete:(void (^)(NSError *error, NSString *script))block;
@end

The default implementation of this delegate method would use the existing RCTJavaScriptLoader and it is backwards-compatible with existing code.

@jwyld
Copy link
Contributor

jwyld commented Jun 19, 2015

I'm wanting better control over this as well. This was my hope with #1463.

I was investigating the route more like the executorClass is done.

@jwyld
Copy link
Contributor

jwyld commented Jun 19, 2015

Depending on the intent of use for the loader, another issue which is related is #1652.

@ide
Copy link
Contributor Author

ide commented Jun 19, 2015

Re: use cases -- another thing I wanted to do was add a progress bar to get a better visual sense of whether loading the script is slow or if the bottleneck is elsewhere.

@jwyld
Copy link
Contributor

jwyld commented Jun 19, 2015

I've filed a few issues around the loading and the bridge setup. In my case, the code is coming off disk. I changed the loader to page is directly, and my code is in UTF16 format. There is no UTF8 conversion cost, no overhead allocation cost, and it helps the lex a little bit as well. I've moved the loader creation to be earlier, so I can start the paging right away and allow the bridge to get set up in the meantime. There is a semaphore wait in the bridge which causes a stall. Moving some things around and allowing the bridge to do some things in parallel has dropped the stall.

My point is if you aren't downloading off the network, the bridge is adding overhead. The majority of the time is the JS lex.

I'm processing through more performance runs to see what can be done.

@brentvatne
Copy link
Collaborator

👍 this is a nice idea

@ide
Copy link
Contributor Author

ide commented Aug 15, 2015

Thanks @tadeuzagallo =)

@ide ide closed this as completed Aug 15, 2015
@facebook facebook locked as resolved and limited conversation to collaborators Jul 22, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants