当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript bluebird.resolve函数代码示例

本文整理汇总了TypeScript中bluebird.resolve函数的典型用法代码示例。如果您正苦于以下问题:TypeScript resolve函数的具体用法?TypeScript resolve怎么用?TypeScript resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了resolve函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: expect

 .then(() => {
   expect(getState().persistenceQueue.count()).to.eql(1)
   stub.returns(Promise.resolve())
   dispatch(createStickyAction({x: 1, y: 2, body: 'some other sticky', uuid: 'some uuid'}))
   expect(getState().persistenceQueue.count()).to.eql(2)
   stub.reset()
   stub.returns(Promise.resolve())
 })
开发者ID:mlawrie,项目名称:sticky-board,代码行数:8,代码来源:persistenceMiddleware.test.ts

示例2: filterByStigmas

 filterByStigmas(stigma: string) {
     if (stigma && stigma !== 'all') {
         return Promise.resolve(this.$filter('filterWhoHasStigma')(this.data, stigma))
             .then((data: Array<Object>) => {
                 this.data = data;
             });
     }
     return Promise.resolve();
 }
开发者ID:automaidan,项目名称:judges,代码行数:9,代码来源:prosecutors.controller.ts

示例3: postImportRoutine

function postImportRoutine(db) {
    if (db.sequelize.dialect.name === 'postgres') {
        return Promise.resolve(_.toArray(db.models))
            .map(model => {
                return updatePostgresSequence(model, db);
            });
    }

    return Promise.resolve(null);
}
开发者ID:Blocklevel,项目名称:contoso-express,代码行数:10,代码来源:seederDefault.ts

示例4: findBy

 public findBy(by: Object): Promise<Token | null> {
     if ((by as any).token === "test" || (by as any).token === "testexpired") {
         return Promise.resolve({
             createdDate: moment(new Date()).subtract({days: 1}).toDate(),
             expiredDate: moment(new Date()).add({days: 1}).toDate(),
             token: "test",
             user: {},
         } as any);
     } else {
         return Promise.resolve(null);
     }
 }
开发者ID:dominikus1993,项目名称:twitterClone,代码行数:12,代码来源:repositoryMock.ts

示例5: PouchDB

 .catch(function (error: any) {
     if (error && error.error && error.name == 'indexed_db_went_bad') {
         // we are in private mode...
         console.log('private mode...')
         inMemory = true;
         _db = new PouchDB("pxt-" + pxt.storage.storageId(), { adapter: 'memory' })
         return Promise.resolve(_db);
     } else {
         _db = temp;
         return Promise.resolve(_db);
     }
 })
开发者ID:wenwei-dev,项目名称:pxt,代码行数:12,代码来源:db.ts

示例6: makeCookieAuthPromise

 private makeCookieAuthPromise() {
   if (this.authType !== 'cookie') return Bluebird.resolve();
   return Bluebird.resolve().then(() => {
     return this.client.post(this.compositeUri({prefix: '', uri: '/login.action'}))
       .type('form')
       .send({ os_username: this.username, os_password: this.password })
       .then(o => o.body)
       .catch(e => {
         throw new Error('CookieAuth has failed');
       });
   });
 }
开发者ID:heycalmdown,项目名称:node-confluence,代码行数:12,代码来源:index.ts

示例7: parseObdString

/**
 * Parses an OBD output into useful data for developers
 * @param  {String} str
 * @return {Object}
 */
function parseObdString (str: string) : Promise<OBDOutput|null> {
  log('parsing command string %s', str);

  let bytes = getByteGroupings(str);

  let ret:OBDOutput = {
    ts: new Date(),
    bytes: str,
    value: null,
    pretty: null
  };

  if (!isHex(str)) {
    log(
      'received generic (non hex) string output "%s", not parsing',
      str
    );
    return Promise.resolve(ret);
  } else if (bytes && bytes[0] === OBD_OUTPUT_MESSAGE_TYPES.MODE_01) {
    log(
      'received valid output "%s" of type "%s", parsing',
      str,
      OBD_OUTPUT_MESSAGE_TYPES.MODE_01
    );

    let pidCode: string = bytes[1];

    let pid:PID|null = pids.getPidByPidCode(pidCode);

    if (pid) {
      log(`we have a matching class for code "${pidCode}"`);
      // We have a class that knows how to deal with this pid output. Parse it!
      ret.pretty = pid.getFormattedValueForBytes(bytes);

      // pass all bytes returned and have the particular PID figure it out
      ret.value = pid.getValueForBytes(bytes.slice(0));

      ret.name = pid.getName();
      ret.pid = pid.getPid()

      return Promise.resolve(ret);
    } else {
      log('no match found for pid %s', pidCode);
      // Emit the data, but just the raw bytes
      return Promise.resolve(ret);
    }
  } else {
    // Wasn't a recognised message type - was probably our own bytes
    // since the serial module outputs those as "data" for some reason
    return Promise.resolve(null);
  }
}
开发者ID:evanshortiss,项目名称:obd-parser,代码行数:57,代码来源:parser.ts

示例8: getResourceBufferPromise

export function getResourceBufferPromise(resource:ReadableStream|Buffer|string):Promise<Buffer> {
  // might be a string
  if (typeof resource === 'string') {
    return Promise.resolve(new Buffer(resource));
  }

  // might already be a Buffer
  if (resource instanceof Buffer) {
    return Promise.resolve(resource);
  }
  // probably a stream
  // TODO npe/type check
  return this.streamPromise(resource);
}
开发者ID:kingsquare,项目名称:communibase-connector-js,代码行数:14,代码来源:util.ts

示例9: exec

	exec(
		visitedNamespaceTbl?: { [key: string]: Namespace },
		state?: any
	): Promise<Output[]> {
		var doc = this.doc;
		var namespace = doc.namespace;

		if(state) this.state = state;

		if(!visitedNamespaceTbl) visitedNamespaceTbl = {};
		visitedNamespaceTbl[namespace.id] = namespace;

		return(Promise.resolve(this.prepare()).then((output: Output) => Promise.map(
			namespace.getUsedImportList(),
			(namespace: Namespace) => {
				if(!visitedNamespaceTbl[namespace.id]) {
					if(namespace.doc) {
						var transform = new this.construct(namespace.doc);

						return(transform.exec(visitedNamespaceTbl, this.state));
					}
				}

				return([]);
			}
		).then((outputList: Output[][]) => Array.prototype.concat.apply([output], outputList))));
	}
开发者ID:patrickmeiring,项目名称:cxsd,代码行数:27,代码来源:Transform.ts

示例10:

 .then((task) => {
     if (task) {
         return vol.unassignTask();
     } else {
         return Promise.resolve();
     }
 })
开发者ID:CMUBigLab,项目名称:cmuNodeFbot,代码行数:7,代码来源:handlers.ts


注:本文中的bluebird.resolve函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。