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


TypeScript when.resolve函数代码示例

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


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

示例1: findController

function findController(pinNumber: number): When.Promise<ScheduleController> {
    if (_.has(gpioControllersLookup, pinNumber)) {
        const controller = gpioControllersLookup[pinNumber];
        return When.resolve(controller);
    }
    return When.reject<ScheduleController>('gpio controller for pin ' + pinNumber + ' not found');
}
开发者ID:kaga,项目名称:Home-Sensor,代码行数:7,代码来源:index.ts

示例2: readPin

 readPin(): When.Promise<GpioState> {
     const state = this.gpio.readSync() ? true : false;
     return When.resolve({
         timestamp: new Date(),
         bcmPinNumber: this.bcmPinNumber,
         state: state
     })
         .tap((state) => console.log(JSON.stringify(state, null, 4)));
 }
开发者ID:kaga,项目名称:Home-Sensor,代码行数:9,代码来源:piGpioController.ts

示例3: require

      .then((exists)=> {
        if (exists)
          return when.resolve()

        var def = when.defer()
        var fs = require('fs')
        fs.mkdir(path, (err)=> {
          def.resolve()
        })
        return def.promise
      })
开发者ID:silentorb,项目名称:vineyard-cellar,代码行数:11,代码来源:cellar.ts

示例4: function

 set: function(what: any, data: any) {
   return when.resolve();
 },
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:3,代码来源:settings.ts

示例5: saveSessions

 saveSessions(sessions: NodeRED.ISessions) : When.Promise<any> {
   writeFileSync(this._sessionsPath, JSON.stringify(sessions));
   return when.resolve(sessions);;
 }
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:4,代码来源:scene-storage.ts

示例6: getAllFlows

	getAllFlows() {
		return when.resolve([]);
	}
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:3,代码来源:scene-storage.ts

示例7: getSessions

  getSessions() : When.Promise<NodeRED.ISessions> {
		const sessions = existsSync(this._sessionsPath)
			? JSON.parse(readFileSync(this._sessionsPath, 'utf8'))
			: {};
    return when.resolve(sessions);;
  }
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:6,代码来源:scene-storage.ts

示例8: saveCredentials

	saveCredentials(credentials: NodeRED.ICredentials) : When.Promise<any> {
    writeFileSync(this._credentialsPath, JSON.stringify(credentials));
    return when.resolve(credentials);;
	}
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:4,代码来源:scene-storage.ts

示例9: getCredentials

	getCredentials() {
		const credentials = existsSync(this._credentialsPath)
			? JSON.parse(readFileSync(this._credentialsPath, 'utf8'))
			: {};
    return when.resolve(credentials);;
	}
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:6,代码来源:scene-storage.ts

示例10: saveFlows

	saveFlows(flows: any) {
		return when.resolve(this._nodeRedFlows.saveCurrentFlow(flows));
	}
开发者ID:denwilliams,项目名称:node-red-contrib-scenes,代码行数:3,代码来源:scene-storage.ts


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