Skip to content

Instantly share code, notes, and snippets.

@BarDev
Created January 27, 2012 22:17
Show Gist options
  • Save BarDev/1691229 to your computer and use it in GitHub Desktop.
Save BarDev/1691229 to your computer and use it in GitHub Desktop.
define([
'jquery',
'backbone',
'docsMetro'
],
function ($, Backbone, docsMetro) {
//Main Dashboard View
var Dashboard = Backbone.View.extend({
el: $('#mainContent'),
events: {
},
initialize: function () {
console.log('test');
console.log(docsMetro);
//Validate User Here most likely. Each of the main view's for each app should probably call the same validation function
},
render: function () {
console.log('testing render');
}
});
// Return the Main Dashboard View
return new Dashboard;
});
define([
'jquery',
'backbone'
],
function ($, Backbone) {
//Docs Metro View
var docsMetro = Backbone.View.extend({
el: $('.docs'),
events: {},
initialize: function () {
console.log('docs Metro');
},
render: function () {
console.log('redering docs');
}
});
// Return the View
return new docsMetro;
});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script data-main="main" src="../../scripts/libs/require.js" ></script>
</body>
</html>
require.config({
paths: {
"jquery": "../../scripts/libs/jquery-1.7.1",
"underscore": "../../scripts/libs/underscore",
"backbone": "../../scripts/libs/backbone-AMD",
"dashBoard": "dashboard",
"docsMetro": "docsMetro"
}
});
require(["dashBoard"], function (dashBoard) {
//This function is called when scripts/helper/util.js is loaded.
//If util.js calls define(), then this function is not fired until
//util's dependencies have loaded, and the util argument will hold
//the module value for "helper/util".
console.log(dashBoard);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment