In my module I want to defer the "define" call, but RequireJS running callback once file is loaded, not when "defined"... For example:
a.js:
require(['b'], function(b){
console.log(b);
});
b.js:
define({'foo':'bar'});
This works as expected writing object {foo:bar}. But if i move "define" to deferred function:
b.js:
setTimeout(function(){
define({'foo':'bar'});
}, 1000);
then console.log(b) writes "null".
What's wrong?