Created
September 28, 2011 21:27
-
-
Save sanderpick/1249306 to your computer and use it in GitHub Desktop.
main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window._ = require('underscore'); | |
window.Step = require('step'); | |
window.DNode = require('dnode'); | |
requirejs(['libs/json2', | |
'libs/modernizr-1.7.min', | |
'libs/backbone-min', | |
'libs/store.min'], | |
function () { | |
window.App = { | |
debug: true, | |
start: function () { | |
DNode().connect(function (remote) { | |
try { | |
App.api = remote; | |
App.store = store; | |
App.templator = require('jadeify'); | |
App.publish = require('./minpubsub').publish; | |
App.subscribe = require('./minpubsub').subscribe; | |
App.unsubscribe = require('./minpubsub').unsubscribe; | |
requirejs(['models', 'collections', 'views', 'router', 'backbone-sync'], | |
function (models, collections, views, Router) { | |
App.models = models; | |
App.collections = collections; | |
App.views = views; | |
App.router = new Router(); | |
Backbone.history.start({ | |
pushState: true, | |
silent: true, | |
}); | |
// do something... perhaps, | |
App.publish('AppReady'); | |
}); | |
} catch (err) { | |
console.error('Error in App.start: ' + err + '\n' + err.stack); | |
} | |
}); | |
}, | |
}; | |
requirejs.ready(App.start()); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just re-added App.templator - been using Jade (https://github.com/visionmedia/jade) a lot server-side and node-jadeify (https://github.com/substack/node-jadeify) client-side... it gets pretty magical and heavy weight :) The latest Jade has client-side support so jadeify isn't really needed anymore... but I haven't made the switch yet.