I've got a WebView. It's got some javascript. I need to dynamically and synchronously load more javascript stored in the assets folder.
eval() works just fine when I pull in the code from the asset by hand and pass it as a string.
The problem is that stack traces aren't useful for code that was pulled in with a string eval. You just get "eval at (file:///android_asset/..."
Is there another way to dynamically pull in javascript code, from javascript, that would make stack traces useful?
(FYI, I'm just using WebView as a javascript engine so I can use lots of our existing cross-platform javascript. It's not displaying any sort of useful HTML.)
Edit:
You can add this:
/@ sourceURL=snarkloading.js
To the string that gets evaled, and you'll get snarkloading.js as the name of the file.
<script>element and the browser will properly add the new scripts. And no, don't fetch the contents, just use thesrcparameter and link to the .js file. - TheZ