Skip to content

Instantly share code, notes, and snippets.

@fatbigbright
Created March 26, 2014 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatbigbright/9775898 to your computer and use it in GitHub Desktop.
Save fatbigbright/9775898 to your computer and use it in GitHub Desktop.
一个简单的异步执行demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test page</title>
<script>
window.onload = function(){
var slowTask = function(callback){
setTimeout(function(){
callback();
}, 5000);
};
var finishTask = function(){
var resultNode = document.getElementById('result');
result.innerHTML = "Got a successful result.";
};
slowTask(finishTask);
};
</script>
</head>
<body>
<div id="result">Show result after 5 seconds.</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment