Skip to content
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

Option to disable script tags #31

Open
Jogai opened this issue Apr 1, 2020 · 2 comments
Open

Option to disable script tags #31

Jogai opened this issue Apr 1, 2020 · 2 comments

Comments

@Jogai
Copy link

Jogai commented Apr 1, 2020

I use it in a partial view that gets updated trough ajax, but everytime the javascript is included and executed when the partial view is updated. I'd like an option to not load the scripts, or maybe conditionally?

@Joniff
Copy link
Owner

Joniff commented Apr 2, 2020

What a lovely edge case, what I can suggest is output the map twice, the first one place close to the start of your HTML but wrap it in a <div style="visibility: hidden;"> or <div style="position:none;"> this will include the scripts only once.

@Jogai
Copy link
Author

Jogai commented Apr 2, 2020

Yeah, I can see that its an edge case. Still having an option would be nice 😀

Outputting twice does not solve the problem. The partial view is refreshed, so it does not know of any existing instance on the page.
Also it doesn't matter if its hidden or positioned somewhere else, the script tags gets read after inserting in the dom anyway.
I believe terratype outputs the scripts always on the first instance, but it can't know if its called in a child action. A switch would help me without breaking existing implementations.

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

No branches or pull requests

2 participants