Skip to content

Instantly share code, notes, and snippets.

@klesh
Created June 20, 2016 14:18
Show Gist options
  • Save klesh/c7adf99b4464f41f449b3d13bdebc71b to your computer and use it in GitHub Desktop.
Save klesh/c7adf99b4464f41f449b3d13bdebc71b to your computer and use it in GitHub Desktop.
var P = require('bluebird'); // 浏览器环境可忽略此行 http://bluebirdjs.com/docs/getting-started.html
var $e = $('.box');
P.each(['a', 'b', 'c'], function(html) {
return P.delay(1000).then(function(){
$e.html(html);
});
}).then(function() {
console.log('done');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment