Skip to content

Compiles javascript source file directly into code. Removes Bundle-loading. #129

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 28, 2016

Conversation

mbishop-fiksu
Copy link
Contributor

Removes the requirement of specifying a bundle. The compiler now makes a string constant from the javascript source and always uses that when seeding the WebView.

@mbishop-fiksu mbishop-fiksu changed the title Compiles javascript source file directly into code Compiles javascript source file directly into code. Removes Bundle-loading. Apr 23, 2015
@mbishop-fiksu
Copy link
Contributor Author

Going to try and make it more explicit what is public.

@mbishop-fiksu
Copy link
Contributor Author

Okay, we're back on.

@mbishop-fiksu mbishop-fiksu reopened this Apr 23, 2015
@marcuswestin marcuswestin mentioned this pull request Jul 29, 2015
@lokimeyburg
Copy link
Collaborator

@mbishop-fiksu That's a cool way of including the JS. Do you mind explaining the benefit this would provide? Is it just performance? (PS: there's been a few changes to master that you might want to merge in).

@mbishop-fiksu
Copy link
Contributor Author

@lokimeyburg Be happy to answer your very good question.

It's more than performance. Let's say a developer wants to write a plugin that contains WebViewJavascriptBridge. With the current system, the developer needs to ask anyone using the plugin, "can you also please include this resource in your app?". By removing the resource and compiling the code into the plugin, the only dependency needed to include the plugin is the library.

@lokimeyburg
Copy link
Collaborator

@mbishop-fiksu Cool. Thanks for the explanation. My only worry at the moment with this PR is hiding the Javascript (in an Objective-C file) and obscuring an implantation detail (how it get's added to your project). For a start, I think renaming the file to something like WebViewJavascriptBridge_JS.m might make it more clear that "this is where the Javascript lives". Secondly, adding a comment in the file about why we're doing it this way would go a long way for someone who's trying figure out why we're not just including a Javascript file.

I'll take a deeper look at the PR later next week when I'm back from vacation. Good job - I didn't know about the preprocessor trick!

@marcuswestin
Copy link
Owner

+1 for separate file, clear mention in the code of what's going on, and merge into master

marcuswestin added a commit that referenced this pull request Jan 28, 2016
…paration for merging in #129 which inlines the javascript source via a .m file preprocessor macro
@marcuswestin marcuswestin merged commit 71649ae into marcuswestin:master Jan 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants