I tried with 3 diff modules as defined below
credit.js
define(function(){
return{
getCredits: function (){
console.log("Inside getCredits");
return 10;
}
}
});
product.js
define(function(){
console.log("Inside product");
return {
bookTheProduct: function(){
console.log("Inside bookTheProduct");
return true;
}
}
});
pruchase.js
require.config({
shim: {
purchase: {
deps : ["credit","product"]
}
}
});
define(["credit","product"], function(credit,product){
console.log("purchaseproduct");
return {
purchaseProduct: function (){
console.log("Inside of PurchaseProduct");
var credits = credit.getCredits();
if(credits > 0){
product.bookTheProduct();
return true;
}
return false;
}
}
});
used it in app.js
require(["purchase"],function(purchase){
purchase.purchaseProduct();
})
Tried this in firefox 21.0 , while loading purchase it loaded credit module but never loaded product module . If i reverse the order it loads the product module but not the credit module . Didn't find any help in RequireJs documentation nor in mozilla documentation . Also didn't see anyone cribing abt it . did any body ever faced this problem ? I am doing some thing wrong , if so can you please point me the mistake . thanks