How to use the rsvp.resolve function in rsvp

To help you get started, we’ve selected a few rsvp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hashicorp / vault / ui / app / mixins / cluster-route.js View on Github external
targetRoute !== this.routeName &&
      targetRoute !== transition.targetName &&
      targetRoute !== this.router.currentRouteName
    ) {
      if (
        // only want to redirect if we're going to authenticate
        targetRoute === AUTH &&
        transition.targetName !== CLUSTER_INDEX &&
        !EXCLUDED_REDIRECT_URLS.includes(this.router.currentURL)
      ) {
        return this.transitionTo(targetRoute, { queryParams: { redirect_to: this.router.currentURL } });
      }
      return this.transitionTo(targetRoute);
    }

    return RSVP.resolve();
  },
github muoncore / muon-node / muon / transport / amqp / client.js View on Github external
exports.connect = function (serviceName, protocol, api, discovery) {
  var clientChannel = bichannel.create(serviceName + "-amqp-transport-client");

  //logger.trace('[*** TRANSPORT:CLIENT:BOOTSTRAP ***] connected to amqp-api');
  var handshakeId = uuid.v4();
  var serviceQueueName = helper.serviceNegotiationQueueName(serviceName);
  var serverListenQueueName = serviceName + ".listen." + handshakeId;
  var replyQueueName = serviceName + ".reply." + handshakeId;
  var handshakeHeaders = helper.handshakeRequestHeaders(protocol, serverListenQueueName, replyQueueName);
  logger.trace('[*** TRANSPORT:CLIENT:BOOTSTRAP ***] preparing to handshake...');
  RSVP.resolve()
    .then(findService(serviceName, discovery))
    .then(readyInboundSocket(replyQueueName, api, clientChannel.rightConnection(), serverListenQueueName, replyQueueName, serviceQueueName, handshakeHeaders))
    .then(readyOutboundSocket(serverListenQueueName, protocol, api, clientChannel.rightConnection(), serverListenQueueName, replyQueueName))
    .catch(function (err) {
      logger.warn('client error: ' + err.message);
      if (err.message.indexOf('unable to find muon service') > -1) {
        try {
          // return muon socket messages unable to find server
          var failureMsg = messages.failure(protocol, 'ServiceNotFound', 'transport cannot find service "' + serviceName + '"');
          clientChannel.rightConnection().send(failureMsg);
        } catch (err2) {
          logger.error(err2.stack);
          throw new Error(err2);
        }
      } else {
        var negotiationErr = new Error(err);
github ember-cli / ember-cli / tests / helpers / mock-watcher.js View on Github external
MockWatcher.prototype.then = function() {
  var promise = RSVP.resolve({
    directory: path.resolve(__dirname, '../fixtures/express-server')
  });
  return promise.then.apply(promise, arguments);
};
github ember-cli / ember-cli / lib / tasks / install-blueprint.js View on Github external
_loadBlueprintFromPath(path) {
    logger.info(`Loading blueprint from "${path}" ...`);
    return RSVP.resolve().then(() => Blueprint.load(path));
  }
github rancher / ui / lib / shared / addon / host / service.js View on Github external
typeDocumentations: this.get('clusterStore').findAll('typedocumentation')
    };

    if (params && params.hostId )
    {
      promises.clonedModel = this.getHost(params.hostId);
    }


    if ( this.get('access.admin') ) {
      let settings = this.get('settings');
      promises.apiHostSet = settings.load(C.SETTING.API_HOST).then(() => {
        return !!settings.get(C.SETTING.API_HOST);
      });
    } else {
      promises.apiHostSet = resolve(true);
    }

    return hash(promises).then((hash) => {
      hash.availableDrivers = this.get('machineDrivers');
      if ( this.get('scope.currentProject.isWindows') ) {
        hash.availableDrivers = [];
      }

      return EmberObject.create(hash);
    });
  },
github poteto / ember-changeset / addon / index.js View on Github external
save(
      options /*: Object */
    ) /*: Promise */ {
      let content     /*: Object */ = get(this, CONTENT);
      let savePromise /*: mixed | Promise */ = resolve(this);
      (this /*: ChangesetDef */).execute();

      if (typeof content.save === 'function') {
        let result /*: mixed | Promise */ = content.save(options);
        savePromise = result;
      }

      return resolve(savePromise).then((result) => {
        (this /*: ChangesetDef */).rollback();
        return result;
      });
    },
github mike-north / ember-data-preload / addon / index.js View on Github external
function getPromise(object, property) {
  return resolve(get(object, property));
}
github TryGhost / Ghost-Admin / app / controllers / settings / labs.js View on Github external
} catch (e) {
                        return reject(new UnsupportedMediaTypeError());
                    }
                };

                reader.readAsText(file);
            });
        }

        let accept = this.get('importMimeType');

        if (!isBlank(accept) && file && accept.indexOf(file.type) === -1) {
            return RSVP.reject(new UnsupportedMediaTypeError());
        }

        return RSVP.resolve();
    },
github HospitalRun / hospitalrun-frontend / app / services / database.js View on Github external
_getNotificationPermissionState() {
    if (navigator.permissions) {
      return navigator.permissions.query({ name: 'notifications' })
        .then((result) => {
          return result.state;
        });
    }
    return RSVP.resolve(Notification.permission);
  },
github Flexberry / ember-flexberry-designer / addon / controllers / fd-data-types-map.js View on Github external
run.next(() => {
        let promise = resolve();
        if (this.serializeTypeMap()) {
          promise = this.get('stage').save();
        }

        promise.then(() => {
          if (close) {
            this.send('close');
          }
        }).catch((error) => {
          this.set('error', error);
        }).finally(() => {
          this.get('appState').reset();
        });
      });
    },