How to use the es6-promise.resolve 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 podio / podio-js / test / push.spec.js View on Github external
it ('should resolve if authentication has been performed', function() {

      var subscribeSpy = sinon.spy();
      
      var host = {
        _getFayeClient: sinon.stub().returns({
          subscribe: subscribeSpy
        }),
        _getAuth: sinon.stub().returns({
          isAuthenticated: sinon.stub().returns(Promise.resolve())
        })
      };

      var options = {
        timestamp: 1435054283,
        expires_in: 21600,
        channel: "/conversation/2256621",
        signature: "7d2018df16bd7686063483c8960124bc0a1bb0e2"
      };

      var handler = new Function();

      var subscription = pushLib.push.call(host, options).subscribe(handler);

      subscription.then(function() {
        // Assert that the Faye client is properly subscribed to
github wevote / WebApp / src / js / dispatcher / RequestDispatcher.js View on Github external
_callbacks.forEach((callback, i) => {
      // Callback can return an obj, to resolve, or a promise, to chain.
      // See waitFor() for why this might be useful.
      Promise.resolve(callback(payload)).then(() => {
        resolves[i](payload);
      }, () => {
        rejects[i](new Error('Dispatcher callback unsuccessful'));
      });
    });
  },
github larsvanbraam / vue-transition-component / script / webpack.js View on Github external
if (jsonStats.errors.length > 0)
				{
					console.error('stats error', jsonStats.errors);
					reject(err);
					return;
				}
				if (jsonStats.warnings.length > 0)
				{
					console.warn('warn', jsonStats.warnings);
				}
				console.log('log', stats.toString());
				resolve();
			});
		});
	});
}, Promise.resolve());
github ianstormtaylor / slate-plugins / packages / slate-drop-or-paste-images / src / index.js View on Github external
function asyncApplyChange(change, file) {
    const { editor } = change

    return Promise.resolve(insertImage(change, file)).then(() => {
      editor.onChange(change)
    })
  }
github CodementorIO / redux-api-middleman / src / index.js View on Github external
const promiseCreators = action[CHAIN_API].map((createCallApiAction) => {
        return createRequestPromise({
          timeout,
          generateDefaultParams,
          createCallApiAction,
          getState,
          dispatch,
          errorInterceptor,
          extractParams,
          maxReplayTimes
        })
      })

      const overall = promiseCreators.reduce((promise, createReqPromise) => {
        return promise.then(createReqPromise)
      }, Promise.resolve())

      overall.finally(resolve).catch(reject)
    })
  }
github web-driverify / web-driverify / src / proxy / assets / utils / driver.js View on Github external
function cmdArrived (cmd) {
  if (wd.state !== STATES.RUNNING) return
  logger.log('command received', JSON.stringify(cmd))
  var handler = wd.handlers[cmd.name]
  Promise.resolve(handler)
    .then(function notFound (handler) {
      if (handler) return handler
      throw new UnknownCommand()
    })
    .then(function exec (handler) {
      logger.log('applying endpoint handler...')
      return handler.apply(cmd, cmd.args)
    })
    .then(function (result) {
      logger.log(string.fromCmd(cmd).summary(), 'handler returned:', string(result).summary())
      if (handler.halt) {
        logger.log('halt set, skip sending...')
        stop()
        return
      }
      send('result/', cmd, result, handler.done)