Explanation of define of the RequireJS library

前端 未结 4 1135
悲哀的现实
悲哀的现实 2021-01-30 08:29

I started to read several tutorials about RequireJS. In none of them was the \"define\" keyword explained satisfactorily for me. Could someone help me with the following :

4条回答
  •  不知归路
    2021-01-30 09:14

    I think the RequireJs API specification sums it up pretty well:

    If the module has dependencies, the first argument should be an array of dependency names, and the second argument should be a definition function. The function will be called to define the module once all dependencies have loaded. The function should return an object that defines the module.

    They list examples of all the various syntactic forms of defines.

提交回复
热议问题