Created
January 13, 2015 20:46
-
-
Save PiJoules/c8622e6becb4a27f93b0 to your computer and use it in GitHub Desktop.
Function for calling asynchronous functions
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
/** | |
* 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