Question

I've written my own js library, how can i make other existing js files use it. For example, i created a video project, which include a default homepage scene (including homepgage.css, homepage.html and homepage.js) and a default detail scene (including detail.css, detail.html and detail.js). Then i created my own js file "lib.js" which fetches all video files from my server. Now the question is: how to make the file homepage.js able to use methods of "lib.js". I tried to include lib.js path in the file index.html by using:

<script type='text/javascript' language='javascript' src='scenes/detail.js'></script>
<script type='text/javascript' language='javascript' src='scenes/homepage.js'></script>
<script type='text/javascript' language='javascript' src='scenes/lib.js'></script>

I also include script tag:

<script type='text/javascript' language='javascript' src='scenes/lib.js'></script>

in the file homepage.html.

but both of them do not work.

Anybody know how to solve this ?

Was it helpful?

Solution

SmartTV application acts like normal website. If you want to use methods from lib.js you should include script before those methods are used. In your case problem may be in accessing methods from lib.js before they are declared. You should check emulator console to find such errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top