Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.js

Created Sep 6, 2017
Embed
What would you like to do?
var loop = h5.async.loop(new Array(5), function (i, v) {
  var deffered = h5.async.deferred();
  var loop = function (count) {
    setTimeout(function () {
      console.log(count);
      deffered.resolve(count);
    }, 100);
  };
  loop(i);
  return deffered.promise();
}).done(function () {
  console.log("処理完了");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment