Skip to content

Instantly share code, notes, and snippets.

@rmurphey
Created May 9, 2013 23:52
Show Gist options
  • Select an option

  • Save rmurphey/5551495 to your computer and use it in GitHub Desktop.

Select an option

Save rmurphey/5551495 to your computer and use it in GitHub Desktop.

Revisions

  1. rmurphey created this gist May 9, 2013.
    43 changes: 43 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    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 () {

    });
    }
    })