How to use the q.resolve function in q

To help you get started, we’ve selected a few q 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 aspnet / Wave / client / controller.js View on Github external
msg.exitcode = 0;
                    // Send message back to controller.
                    cmdport.send(args.topic, msg);
                    return;
                }
            }

            var nextcmd = msgProcessor.process(msg, args.topic);
            if (nextcmd == null) {
                //client.end();
                // setTimeout(function() {
                //     process.exit();
                // }, 1000);
                return;
            }
            var setenvPromise = Q.resolve();
            if(nextcmd.setenv) {
                for (var target in nextcmd.env) {
                    var newenv = nextcmd.env[target];
                    var envmsg = {
                        command: "setenv",
                        logdir: nextcmd.env[target]["logdir"],
                    }
                    if( typeof newenv["$path"] != 'undefined'){
                        envmsg.path = newenv["$path"];
                        delete newenv["$path"];
                    }
                    envmsg.env = newenv;
                    setenvPromise = sendCommand(nextcmd.env[target][target], envmsg);
                }
            }
            var clientTopic = nextcmd.target;
github awwright / magnode / lib / route.setup.js View on Github external
function namespace(uri, httpd, resources){
		var iri = new (require('iri').IRI)(uri);
		var pathParts = (iri.path() || '').split('/');
		if(pathParts[1]==='about:setup'){
			var base = iri.resolveReference('/about:setup/').toString();
			return require('q').resolve({
				// the base is... whatever the page was requested with
				base: base,
				// But the 'permalink' to the namespace is http://localhost/about:setup/
				resource: 'http://localhost/about:setup/'+iri.toString().substring(base.length),
				label: 'Setup',
				option: {
					'http://magnode.org/Setup': setupOpts,
					useTransformTypes: ['http://magnode.org/view/Setup'],
				}
			});
		}
	}
github katzer / cordova-plugin-badge / node_modules / cordova-osx / bin / lib / check_reqs.js View on Github external
module.exports.check_os = function () {
    // Build OSX apps available for OSX platform only, so we reject on others platforms
    return process.platform === 'darwin' ?
        Q.resolve(process.platform) :
        Q.reject('Cordova tooling for OSX requires Apple OS X');
};
github tradle / tim-old-engine / index.js View on Github external
}

  this._debug('received msg')

  var timestamp = hrtime()

  // this thing repeats work all over the place
  var chainedObj
  var promiseValid
  var valid = utils.validateMsg(msg)
  if (valid) {
    // if (msg.txType === TxData.types.public) {
    //   return this._receivePublicMsg(msg, senderInfo)
    // }

    promiseValid = Q.resolve()
  } else {
    promiseValid = Q.reject(new Error('received invalid msg'))
  }

  var from
  return this._receivingPromise = promiseValid
    .then(function () {
      return self.lookupIdentity(senderInfo)
    })
    .then(function (result) {
      from = result
      var fromKey = utils.firstKey(result.identity.pubkeys, {
        type: 'bitcoin',
        networkName: self.networkName,
        purpose: 'messaging'
      })
github Synbiota / GENtle2 / public / scripts / library / sequence_canvas / sequence_canvas.js View on Github external
scrollBaseToVisibility(base) {
    var distanceToVisibleCanvas = this.distanceToVisibleCanvas(base);

    if (distanceToVisibleCanvas !== 0) {
      return this.scrollTo(this.layoutHelpers.yOffset + distanceToVisibleCanvas);
    } else {
      return Q.resolve();
    }
  }
github tschaub / grunt-gh-pages / tasks / gh-pages.js View on Github external
.then(() => {
      if (repo) {
        return Q.resolve(repo);
      }
      return Q.reject(
        new Error('Failed to get repo URL from options or current directory.')
      );
    })
    .fail(err => {
github microsoft / vscode-vsce / src / package.ts View on Github external
		.catch(err => err.code !== 'ENOENT' ? reject(err) : resolve(null))
		.then(() => Promise((c, e) => {
github monaca / monaca-lib / src / localkit / api.js View on Github external
var parse = function(body) {
      try {
        return Q.resolve(qs.parse(body));
      }
      catch (e) {
        return Q.reject({code: 400, message: 'Unable to parse body.'});
      }
    };

q

A library for promises (CommonJS/Promises/A,B,D)

MIT
Latest version published 7 years ago

Package Health Score

63 / 100
Full package analysis