foreachasync.js/test.js

16 lines
348 B
JavaScript
Raw Normal View History

2013-08-06 09:51:22 +00:00
(function () {
"use strict";
var forEachAsync = require('../forEachAsync').forEachAsync
;
forEachAsync([0, 500, 70, 800], function (next, element, i, arr) {
console.log(element, 'is element', i, 'of', arr.length);
this[element] = i;
setTimeout(next, element);
}, {}).then(function () {
console.log(this);
});
}());