Skip to content

Instantly share code, notes, and snippets.

@rmurphey
Created May 9, 2013 23:52
Show Gist options
  • Save rmurphey/5551495 to your computer and use it in GitHub Desktop.
Save rmurphey/5551495 to your computer and use it in GitHub Desktop.
require(['app'], function (App) {
App.init();
});
//app.js
define([
'pages'
], function (pages) {
return {
init : function () {
var page = pages();
page()
}
};
})
//
// pages.js
define([
'pages/home',
'pages/static'
], function (home, static) {
return function () {
var pages = {
home : home,
static : static
};
var page = $('body').attr('data-page');
return pages[page];
}
})
// pages/home.js
define([], function () {
return function () {
$(document).ready(function () {
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment