當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。