Skip to content

Instantly share code, notes, and snippets.

@PiJoules
Created January 13, 2015 20:46
Show Gist options
  • Save PiJoules/c8622e6becb4a27f93b0 to your computer and use it in GitHub Desktop.
Save PiJoules/c8622e6becb4a27f93b0 to your computer and use it in GitHub Desktop.
Function for calling asynchronous functions
/**
* Pass a function to fn along with an optional callback
*/
function async(fn, callback) {
setTimeout(function() {
fn();
if (typeof callback !== "undefined")
callback();
}, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment