I have .js files of the following form:
define([
'jquery',
'backbone'
], function($, Backbone) {
// function stuff here
}
What's the purpose of writing the file that way? Is it some convention to define it like that?
They're using the CommonJS AMD-style definitions to register modules.
Info: http://www.sitepen.com/blog/2010/11/04/requirejsamd-module-forms/
The first argument is the module dependencies, and the second is the module itself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.