繁体   English   中英

什么是。define([...],function(...){...})形式的.js文件的含义;“

[英]What's the meaning of .js file of the form “define([…], function(…) {…});”

我有以下形式的.js文件:

define([
   'jquery',
  'backbone'
], function($, Backbone) {
  // function stuff here
}

以这种方式编写文件的目的是什么? 这样定义它是一种约定吗?

他们使用CommonJS AMD风格的定义来注册模块。

信息: http//www.sitepen.com/blog/2010/11/04/requirejsamd-module-forms/

第一个参数是模块依赖项,第二个参数是模块本身。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM