What I’m trying to do:
I’m trying to load the trading view charting library. I feel I"m getting close but trading view isn’t referencing and Im really new to javascript. How do I debug the javascript and print out to console? What I’ve tried and what’s not working:
I tried putting the script in the native libraries but that doesn’t seem to be working. I’m following this tutorial.
This is the Error I got:
[An internal error has occurred] - see browser console for more details
SyntaxError: Unexpected identifier 'type'
at https://anvil.works/runtime-new/runtime/dist/runner.bundle.js?sha=32557e83f4393eef89d55626581aba8a37f5b5f157e966d2ba9aff661b766300:572:1824
[An internal error has occurred] - see browser console for more details
ReferenceError: Tradingview is not defined
at <anonymous>:2:13
at https://anvil.works/runtime-new/runtime/dist/runner.bundle.js?sha=32557e83f4393eef89d55626581aba8a37f5b5f157e966d2ba9aff661b766300:572:1824
Hey,
Yea i noticed the javascript runs and stops and runs again, but nothing ever shows. I don’t know if its in an infinite loop but feelsl ike it. I uploaded to my public github, i wasn’t able to clone my own link either. but all the trading view library is in theme asset folder
I don’t see anywhere in that github repo that you’re actually trying to use the library. I see it included in the Native Libraries and assets, but no forms that use it.
It feels really strange, like when I load the javascript, anvil doesn’t save my code, and the project link you have me check out and clone, just refreshes and takes along time to load and I’m still waiting. I don’t know if its because I’m on the lowest tier plan and its going slow. Been waiting several minutes and its still spinning.
I had put this in my html but didnt’ save for some reason when I put it in my personal github. All u see is it spinning and thinking but nothing shows but white background.
Custom HTML forms are already inside a web page, so you do not want to put an entire web page inside them. The only HTML you put into a custom HTML page is the specific HTML for the component. e.g. a div, etc.
Your script tags should generally go into the Native Libraries section of your app, so they get loaded once when the app is loaded. You also don’t need to work in Javascript at all, the Anvil Javascript bridge allows you to do it all from Python, as in the example app.
I can confirm that my example app works fine in a free plan. If you’re seeing an infinite spinner, then something else is going on.