Skip to content

Instantly share code, notes, and snippets.

@lance
Created February 17, 2014 19:39
Show Gist options
  • Save lance/9057460 to your computer and use it in GitHub Desktop.
Save lance/9057460 to your computer and use it in GitHub Desktop.
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);
~/t/myapp ❯❯❯ vertx run app.js
Succeeded in deploying verticle
Doing async thing
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