How to use the defer function from bluebird

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

5
6
7
8
9
10
11
12
13
14

// Returns a promise that will be resolved with an array of open ports
test: bluebird.method(function(port, iface, callback) {
  var that = this;
  var log = debug('portastic:test');
  var def = bluebird.defer();

  // Callback handling
  def.promise
    .then(function(ports) {
fork icon8
star icon76
watch icon1

+ 3 other calls in file

68
69
70
71
72
73
74
75
76
77
}

// Export
module.exports.gracefullyKill = function(proc, timeout) {
  function killer(signal) {
    var deferred = Promise.defer()

    function onExit() {
      deferred.resolve()
    }
fork icon5
star icon11
watch icon3

+ 3 other calls in file

871
872
873
874
875
876
877
878
879
880
that.pushEval(tree);

function pushEval(tree) {
    console.log("pushEval expression: " + arrayToNock(tree));

    var resolver = Promise.defer();
    var nocker = findNocker(tree, that);
    if (!nocker) {
        console.log("could not find a nocker");
        return Promise.resolve(undefined);
fork icon2
star icon11
watch icon0

+ 7 other calls in file

14
15
16
17
18
19
20
21
22
23
 * @returns {*}
 */
init(config) {
    const logger = require('cf-logs').Logger('codefresh:infra:redis'); // eslint-disable-line
    this.logger = logger;
    const deferred = Promise.defer();

    // TODO a fallback for case where redis is not up. should be removed once redis is fully used
    setTimeout(() => {
        deferred.resolve();
fork icon0
star icon2
watch icon11

+ 5 other calls in file