How to use the settle function from bluebird

Find comprehensive JavaScript bluebird.settle code examples handpicked from public code repositorys.

52
53
54
55
56
57
58
59
60
61
  });
}
else if (_.isObject(myRequests)) {
  var keys = _.keys(myRequests);

  return Promise.settle(wrapped).then(function(settledValues) {
    var resolved = _.zipObject(keys, getSettledValues(settledValues));
    return  Promise.resolve(resolved);
  });
}
fork icon5
star icon56
watch icon1

+ 3 other calls in file

5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
    debug.deprecated(".settle()", ".reflect()");
    return new SettledPromiseArray(promises).promise();
};


Promise.prototype.settle = function () {
    return Promise.settle(this);
};
};


},{"./util":36}],31:[function(_dereq_,module,exports){
fork icon3
star icon16
watch icon0

5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
        }
    }
    resources[i] = resource;
}

var promise = Promise.settle(resources)
    .then(inspectionMapper)
    .then(function(vals) {
        promise._pushContext();
        var ret;
fork icon2
star icon11
watch icon0

+ 3 other calls in file

4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
            resource._setDisposable(disposer);
        }
        resources[i] = resource;
    }

    return Promise.settle(resources)
        .then(inspectionMapper)
        .spread(fn)
        ._then(disposerSuccess, disposerFail, void 0, resources, void 0);
};
fork icon1
star icon2
watch icon1

171
172
173
174
175
176
177
178
179
180

            return _tag;
        }));
    });

    return Promise.settle(ops);
},

importPosts: function importPosts(tableData, transaction) {
    if (!tableData) {
fork icon0
star icon1
watch icon0

+ 3 other calls in file

167
168
169
170
171
172
173
174
175
176
    _.each(data.data[tableName], function (importValues) {
        validateOps.push(validation.validateSchema(tableName, importValues));
    });
});

return Promise.settle(validateOps).then(function (descriptors) {
    var errorList = [];

    _.each(descriptors, function (d) {
        if (d.isRejected()) {
fork icon0
star icon1
watch icon0

39
40
41
42
43
44
45
46
47
48
}

// Import users, deduplicating with already present users
userOps = utils.importUsers(tableData.users, users, t);

return Promise.settle(userOps).then(function (descriptors) {
    descriptors.forEach(function (d) {
        if (d.isRejected()) {
            errors = errors.concat(d.reason());
        } else {
fork icon0
star icon1
watch icon0

486
487
488
489
490
491
492
493
494
495
})

frameProducer.on('readable', function next() {
  var frame = frameProducer.nextFrame()
  if (frame) {
    Promise.settle([broadcastSet.keys().map(function(id) {
      return broadcastSet.get(id).onFrame(frame)
    })]).then(next)
  }
  else {
fork icon0
star icon1
watch icon0

1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377


test('new Promise -> settle', function (t) {
  t.plan(6)
  twice(function () {
    var trans = ins.startTransaction()
    Promise.settle([resolved('foo')]).then(function (result) {
      t.strictEqual(result.length, 1)
      t.ok(result[0].isFulfilled())
      t.strictEqual(ins.currTransaction().id, trans.id)
    })
fork icon1
star icon0
watch icon1

+ 2 other calls in file