Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created June 11, 2015 12:19
Show Gist options
  • Save cowboy/2c44253816efb3470156 to your computer and use it in GitHub Desktop.
Save cowboy/2c44253816efb3470156 to your computer and use it in GitHub Desktop.
JavaScript: Does My Async Abstraction Work? Per https://twitter.com/ryanflorence/status/608841603956903937
Function.prototype.doesMyAsyncAbstractionWork = function() {
var fn = this;
var args = arguments;
setTimeout(function() {
fn.apply(null, args);
}, Math.random() * 5000);
};
for (var i = 0; i < 10; i++) {
console.log.bind(console).doesMyAsyncAbstractionWork("hello %d", i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment