Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@osama-raddad
Created June 7, 2017 11:00
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 osama-raddad/07330fd7c644f84e04ebcf073785eb9a to your computer and use it in GitHub Desktop.
Save osama-raddad/07330fd7c644f84e04ebcf073785eb9a to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/ziricer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/1.2.2/bluebird.js"></script>
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
new Promise(function(resolve, reject) {
// A mock async action using setTimeout
setTimeout(function() { resolve(10); }, 3000);
})
.then(function(num) { console.log('first then: '+ num); return num * 2; })
.then(function(num) { console.log('second then: '+ num); return num * 2; })
.then(function(num) { console.log('last then: '+ num);});
</script>
<script id="jsbin-source-javascript" type="text/javascript">new Promise(function(resolve, reject) {
// A mock async action using setTimeout
setTimeout(function() { resolve(10); }, 3000);
})
.then(function(num) { console.log('first then: '+ num); return num * 2; })
.then(function(num) { console.log('second then: '+ num); return num * 2; })
.then(function(num) { console.log('last then: '+ num);});</script></body>
</html>
new Promise(function(resolve, reject) {
// A mock async action using setTimeout
setTimeout(function() { resolve(10); }, 3000);
})
.then(function(num) { console.log('first then: '+ num); return num * 2; })
.then(function(num) { console.log('second then: '+ num); return num * 2; })
.then(function(num) { console.log('last then: '+ num);});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment