How to integrate 3rd Party Javascript Libraries

325 views
Skip to first unread message

Stephen Miles

unread,
Apr 5, 2019, 3:24:22 AM4/5/19
to DroidScript
Hallo dear friends. 

I have to say I am so happy that I found this! This looks like exactly what I want/need!

Just one question: In general and especially when going with the HTML5/Webview, how can I integragte thrid party libraries.
I want to use React (and that on itself is working) and a Graphing Library called Apexcharts. 
When I try to include them like in the following:

  <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
 
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
 
<script src="https://cdn.jsdelivr.net/npm/apexcharts" crossorigin></script>
 
<script src="https://cdn.jsdelivr.net/npm/react-apexcharts" crossorigin></script>

I get an error saying 
Script Error: exports is not defined, Line 1, react-apexcharts

I really don't understand all this javascript packaging stuff... there is too much for me to have a clear understanding.....

Please point me in the right direction.


Second question:
Can I use TypeScript with this?

THank you guys, and keep up the good work, its really amazing!!

Dave

unread,
Apr 6, 2019, 9:00:30 AM4/6/19
to DroidScript
Hi Stephen,

If you are using the WebView control, then you might find that you need to use the "IgnoreErrors" option in the app.CreateWebView() call sometimes because 3rd party libraries often have unhandled errors in them which would normally be ignored by the browser (just logged).

(We don't ignore errors in the webview by default because you might be using your own code and need to catch those errors)

Also you may find that on older Android phones (especially those before lollipop), some of the HTML5 features that work in the Chrome browser are not supported by the Android webview.

Stephen Miles

unread,
Apr 8, 2019, 12:50:31 AM4/8/19
to DroidScript
Thank you Dave,

I am not really using the WebView I just figured out, but the HTML5 App option (Where everything is a WebView?)
How do I disable Errors there? And then, when I disable errors, how can I see my own errors?

And my second Question is still open, please:
Can I use TypeScript with DroidScript?

Thank you for your help/time :)


Steve Garman

unread,
Apr 8, 2019, 3:05:01 AM4/8/19
to DroidScript
Try using app.SetOptions("IgnoreErrors")

I would not recommend trying to use typescript with DroidScript.

Helmut Jarausch

unread,
Apr 24, 2019, 5:11:18 AM4/24/19
to DroidScript
Hi,

I'm missing local editing features.
I'd like to select a folder (preferably on the external SD card) where to store/restore and execute scripts.
The remote editing features doesn't work on the same device. When invoking it via localhost:8088 it always
switches to Google Play. Even a simple paste from the clip box doesn't work.

Please implement the selection of a selectable, dedicated folder, at least.
Thanks,
Helmut

John

unread,
Jun 6, 2019, 5:28:19 PM6/6/19
to DroidScript
Don't disable error messages while you're still developing your app or it won't tell you what's broken.

Instead, change the script source of react-apexcharts to <script src="https://unpkg.com/react-ap...@1.3.3/dist/react-apexcharts.iif.min.js" crossorigin></script>

We can discuss packaging issues later if you still want to. :-)

Can you use TypeScript? Not directly. Compile first then you can use it.

Reply all
Reply to author
Forward
0 new messages