define([ "require", "jquery", "blade/object", "blade/fn", "rdapi",
"oauth", "blade/jig", "blade/url", "dispatch", "accounts",
"storage", "services", "widgets/AccountPanel", "widgets/TabButton",
"widgets/AddAccount", "less", "osTheme", "jquery-ui-1.8.7.min",
"jquery.textOverflow"],
function (require, $, object, fn, rdapi,
oauth, jig, url, dispatch, accounts,
storage, services, AccountPanel, TabButton,
AddAccount, less, osTheme) {
});
Module = require('module')
User = require('user')
...
define(['require', 'dependency1', 'dependency2'], function (require) {
var dependency1 = require('dependency1'),
dependency2 = require('dependency2');
return function () {};
});
require.config({
// Описываем пути
baseUrl: '../js'
paths: {
jquery: 'libs/jquery',
someModule: 'module'
},
// Описываем зависимости для модулей
shim: {
someModule: ['jquery']
}
});
define(function(){
...
obj.someFunc = function(){
$("#someButton").click(...)
}
return obj;
});
define(
'blade',
['blade/object', 'blade/fn', 'blade/jig', 'blade/url'],
function(object, fn, jig, url) {
return {
object: object,
fn: fn,
jig: jig,
url: url
}
}
)
// …
define(
['blade', 'require', 'jquery'],
function(blade, require, jquery) {
// …
}
)