本文整理匯總了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));
}