Permalink
Browse files

Add app `ready` event which is emitted once Locator is finished

  • Loading branch information...
1 parent f6ac022 commit 1fab1b6c0d6e277568c76f7d53e4bca03d4228d3 @ericf committed Jul 29, 2013
Showing with 5 additions and 2 deletions.
  1. +1 −0 app.js
  2. +4 −2 server.js
View
1 app.js
@@ -115,6 +115,7 @@ locator = new Locator({buildDirectory: 'build'})
locator.parseBundle(__dirname, {}).then(function () {
app.yui.use('pnm-helpers');
+ app.emit('ready');
}, function (err) {
console.error(err);
console.error(err.stack);
View
@@ -2,6 +2,8 @@ var http = require('http'),
app = require('./app'),
port = app.get('port');
-http.createServer(app).listen(port, function () {
- console.log(app.get('name') + ' Server listening on ' + port);
+app.on('ready', function () {
+ http.createServer(app).listen(port, function () {
+ console.log(app.get('name') + ' Server listening on ' + port);
+ });
});

0 comments on commit 1fab1b6

Please sign in to comment.