How to distinguish is dependencies module or not dependencies module?

44 views
Skip to first unread message

Jeson Xu

unread,
Jan 6, 2014, 10:10:08 PM1/6/14
to amd-im...@googlegroups.com

//I have two modules,one is dependencies module and the other one is not dependencies module. But when i use main module require modules how to distinguish is dependencies or not?

//base.js This's a dependencies module.

//math.js This's a not dependencies module.


// main.js require dependencies module use array method.

  require(['base'], function (math){

    alert(math.add(1,1));

  });


// main.js require dependencies module use array method.

  require(['math'], function (math){

    alert(math.add(1,1));

  });


I do not see what these two require modules are not the same?

James Burke

unread,
Jan 8, 2014, 3:06:01 PM1/8/14
to amd-im...@googlegroups.com
I am not sure what the question is: in those two examples, ‘base’ and
‘math’ are two different module IDs so by default, they normally point
to two different modules. The argument name used for the function
callback, in this case “math”, can be spelled any way it likes, it is
just a local variable that points to the first dependency in the
dependency array. The name is not special in any way.

James
Reply all
Reply to author
Forward
0 new messages