문제

In the official guide of RequireJs there's a define example:

define(["require", "./relative/name"], function(require) {
    var mod = require("./relative/name");
});

The first dependency, "require" is returned and inserted into the first parameter of the function.

Where does the second dependency goes?

Is it for the use of the require function that is executed inside? What does it return into "mod"?

도움이 되었습니까?

해결책

The second dependency will be the second parameter like so:

define(["require", "./relative/name"], function(require, mod) {
    console.log(mod);
});

See: http://requirejs.org/docs/api.html#defdep

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top