-
-
Save malintha/03893106d19b7210ad7fab4b401d5ec7 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
find([1,2], response); | |
function response(err, result) { | |
if(err) { | |
alert(err); | |
} | |
else { | |
alert("operation successful : "+result); | |
} | |
} | |
alert("meanwhile I show up"); | |
function find(elements, callback) { | |
//The time consuming operation | |
setTimeout(function() { | |
if(elements) { | |
elements.push(3,4,5); | |
callback(null, elements); | |
} | |
else { | |
callback("Elements array should not be null", null); | |
} | |
} ,2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment