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
// EXEMPLO: | |
before(function (done) { | |
// Nos certificamos de que o código dentro do callback irá executar | |
// apenas quando o evento for disparado. | |
app.on('appInitialized', function () { | |
// Um model qualquer | |
var Model = require('mongoose').model('Model'); | |
done(); | |
}); | |
}); |
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
// Dentro do arquivo app.js ou server.js | |
// EXEMPLO: | |
app.listen(port, function () { | |
console.log('Listening on port %s', port); | |
app.emit('appInitialized'); | |
}); |
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
//'use strict'; | |
var system = require('system'); | |
// If not specified, 3 sec is used | |
var timeOutMillis; | |
/** | |
* Wait until the test condition is true or a timeout occurs. Useful for waiting | |
* on a server response or for a ui change (fadeIn, etc.) to occur. | |
* |