How to use the es6-promise.Promise.cast function in es6-promise

To help you get started, we’ve selected a few es6-promise 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 sandstorm-io / sandstorm / src / sandstorm / capnp.js View on Github external
return function (request) {
    var params = v8capnp.toJsParams(request, Capability);
    v8capnp.releaseParams(request);
    Promise.cast(method.apply(self, params)).then(function (results) {
      if (typeof results !== "object") {
        if (results === undefined) {
          results = [];
        } else {
          // Wrap single primitive return value in an array.
          results = [results];
        }
      }
      v8capnp.fromJs(v8capnp.getResults(request), results, LocalCapWrapper);
      v8capnp.return_(request);
    }).catch(function (error) {
      v8capnp.throw_(request, error);
    }).catch(function (error) {
      console.error("Cap'n Proto v8 bug when returning from incoming method call:", error);
    });
  }
github TypeStrong / grunt-ts / tasks / ts.ts View on Github external
var next = () => {
            if (arr.length === 0) {
                resolve(memo);
                return;
            }
            Promise.cast(iter(arr.shift())).then((res: W) => {
                memo.push(res);
                next();
            }, reject);
        };
        next();
github TypeStrong / atom-typescript / node_modules / grunt-ts / tasks / modules / compile.js View on Github external
return executeNode([tsc, '@' + tempfilename]).then(function (result) {
        if (task.fast !== 'never' && result.code === 0) {
            resetChangedFiles(newFiles, targetName);
        }
        result.fileCount = files.length;
        fs.unlinkSync(tempfilename);
        exports.grunt.log.writeln(result.output);
        return Promise.cast(result);
    }, function (err) {
        fs.unlinkSync(tempfilename);
github TypeStrong / atom-typescript / node_modules / grunt-ts / tasks / ts.js View on Github external
var next = function () {
            if (arr.length === 0) {
                resolve(memo);
                return;
            }
            Promise.cast(iter(arr.shift())).then(function (res) {
                memo.push(res);
                next();
            }, reject);
        };
        next();
github TypeStrong / grunt-ts / tasks / modules / compile.ts View on Github external
return executeNode([tsc, '@' + tempfilename]).then((result: ICompileResult) => {

        if (task.fast !== 'never' && result.code === 0) {
            resetChangedFiles(newFiles, targetName);
        }

        result.fileCount = files.length;

        fs.unlinkSync(tempfilename);

        grunt.log.writeln(result.output);

        return Promise.cast(result);
    }, (err) => {
            fs.unlinkSync(tempfilename);
github TypeStrong / grunt-ts / tasks-internal / modules / compile.ts View on Github external
return executeNode([tsc, '@' + tempfilename]).then((result: ICompileResult) => {

        if (task.fast !== 'never' && result.code === 0) {
            resetChangedFiles(newFiles, targetName);
        }

        result.fileCount = files.length;

        fs.unlinkSync(tempfilename);

        grunt.log.writeln(result.output);

        return Promise.cast(result);
    }, (err) => {
            fs.unlinkSync(tempfilename);