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

Add modevlib/threads/thread.js to HTML HEAD #2

Closed
klahnakoski opened this issue Mar 29, 2016 · 3 comments
Closed

Add modevlib/threads/thread.js to HTML HEAD #2

klahnakoski opened this issue Mar 29, 2016 · 3 comments

Comments

@klahnakoski
Copy link
Contributor

If using thread.js, then it will be simpler to add it as a script to the HEAD of each *.html file:

<script type="application/javascript" src="modevlib/threads/thread.js"></script>

Remove instances of

importScript(['modevlib/main.js'], function () {

The modevlib library is a collection of smaller libraries for building charting dashboards. It copies the import.js[1] and thread.js[2] source code, which have their own documentation.

[1] https://github.com/klahnakoski/jsImport
[2] https://github.com/mozilla/jsThreads

@chinhodado
Copy link
Owner

I tried to add thread.js directly, but it requires the aLog.js library, which in turn requires the template library, etc. The dependency list is too much to add in as <script> tags manually. Is it possible to do a blocking importScript(['modevlib/main.js']) instead?

@klahnakoski
Copy link
Contributor Author

thread.js should work without aLog.js. thread.js will make a simplified version of the Log object if it does not already exist.

Yes, you are right, if you want to use the code in aLog.js also, then the dependency tree gets big fast. In this case, your main page should have something like:

<script type="application/javascript">
importScript(['js/main_lib.js'], function(){
    //SETUP JAVASCRIPT HOOKS FOR PAGE HERE
})
</script>

This script will be run during page load, so should be one of the first scripts, and it will perform the script loading before running the function you pass it. All your other script files will not need to call importScript because it was done here.

@chinhodado
Copy link
Owner

Done with 14e23d9

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