Reputation: 11177
define("file2",['file1'],function(){console.log('World')})
file2.js
var oli={name:boo.joni};
file1.js
var boo={joni:100};
I want to included the file "file2", before it needs to be loaded "file1". Once all scripts must call callbacks. It does not work.
Upvotes: 0
Views: 82
Reputation: 7070
Looks like you need javascript loader with dependencies, take a look here for example:
http://www.dustindiaz.com/scriptjs
There are also some answers here: JavaScript dependency management How do I include a JavaScript file in another JavaScript file? Javascript dependency solution with arbitrary ordered includes
Upvotes: 1