Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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