Created
February 17, 2014 19:39
-
-
Save lance/9057460 to your computer and use it in GitHub Desktop.
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
var vertx = require('vertx'); | |
var timeoutProxy = function(callback, delay) { | |
vertx.setTimer(delay, callback, Array.prototype.slice.call(2, arguments)); | |
} | |
// Make the setTimeout function global if it doesn't exist already | |
setTimeout = (typeof setTimeout === 'function') ? setTimeout : timeoutProxy; | |
var thing = require('thing'); | |
thing.doAsyncThing(function() { | |
print("Doing async thing"); | |
}, 10000); |
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
~/t/myapp ❯❯❯ vertx run app.js | |
Succeeded in deploying verticle | |
Doing async thing | |
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
module.exports.doAsyncThing = function(callback, delay) { | |
setTimeout(callback, delay); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment