Skip to content Skip to sidebar Skip to footer

How To Wait When Data-main Is Loaded With Require.js Before Executing Script?

I'm having the following code:

Solution 1:

Ended up doing the following, which isn't ideal (sets a global), but it's ok for my examples.

 <!-- sets window.requireconfig with an json object defining paths, etc.-->
 <script src="scripts/requireconfig.js"></script> 

 <!-- in top of example1.js do : require.config(window.requireconfig); -->
 <script data-main="scripts/example1" src="components/requirejs/require.js"></script>

Post a Comment for "How To Wait When Data-main Is Loaded With Require.js Before Executing Script?"