Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 971 Bytes

File metadata and controls

38 lines (25 loc) · 971 Bytes

References

Include a javascript file:

<script type=”text/javascript” src=”abc.js”></script>

function myFunction() { var abc = “hello”; alert(abc); }

import js file

To import a javascript file, you can use RequireJS

In the HTML file that will load the JS put:

<script data-main="scripts/main" src="scripts/require.js"></script>

This says to run the script: scripts/main.js

In main.js require any additional files with:

require(["helper/util"], function(util) {
    //This function is called when scripts/helper/util.js is loaded.
    //If util.js calls define(), then this function is not fired until
    //util's dependencies have loaded, and the util argument will hold
    //the module value for "helper/util".
});