本文整理汇总了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');
}
示例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)));
}
示例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
})
示例4: function
set: function(what: any, data: any) {
return when.resolve();
},
示例5: saveSessions
saveSessions(sessions: NodeRED.ISessions) : When.Promise<any> {
writeFileSync(this._sessionsPath, JSON.stringify(sessions));
return when.resolve(sessions);;
}
示例6: getAllFlows
getAllFlows() {
return when.resolve([]);
}
示例7: getSessions
getSessions() : When.Promise<NodeRED.ISessions> {
const sessions = existsSync(this._sessionsPath)
? JSON.parse(readFileSync(this._sessionsPath, 'utf8'))
: {};
return when.resolve(sessions);;
}
示例8: saveCredentials
saveCredentials(credentials: NodeRED.ICredentials) : When.Promise<any> {
writeFileSync(this._credentialsPath, JSON.stringify(credentials));
return when.resolve(credentials);;
}
示例9: getCredentials
getCredentials() {
const credentials = existsSync(this._credentialsPath)
? JSON.parse(readFileSync(this._credentialsPath, 'utf8'))
: {};
return when.resolve(credentials);;
}
示例10: saveFlows
saveFlows(flows: any) {
return when.resolve(this._nodeRedFlows.saveCurrentFlow(flows));
}