Reputation: 1799
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?
Upvotes: 3
Views: 1356
Reputation: 17434
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.
Upvotes: 1