本文整理汇总了TypeScript中promise.denodeify函数的典型用法代码示例。如果您正苦于以下问题:TypeScript denodeify函数的具体用法?TypeScript denodeify怎么用?TypeScript denodeify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了denodeify函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: execute
execute(environment: env.Environment, argumentList: Array<string>, finished: (env: env.Environment) => void) {
if(argumentList.length === 0) {
finished(environment);
return;
}
var newFolder = argumentList[0];
if(newFolder === "..") {
this.navigateBack(environment).then((env)=>{
finished(env);
});
return;
}
var newPath = path.join(environment.workingDirectory, newFolder);
var fsExists = Promise.denodeify(fs.exists);
new Promise(function(resolve, reject){
fs.exists(newPath, (exists)=>{
resolve(exists);
});
}).then((exists) => {
if(exists) {
finished(new env.Environment(newPath));
return;
}
else {
this.stderr("Path " + newPath + " does not exist");
finished(environment);
return;
}
new Promise(function(resolve, reject){
fs.exists(newFolder, (exists)=>{
resolve(exists);
});
}).then((exists) => {
if(exists) {
finished(new env.Environment(newFolder));
} else {
finished(environment);
}
});
});
}
开发者ID:schultyy,项目名称:jsterm,代码行数:42,代码来源:command.ts
示例2: require
// dependencies
var CryptoA:any = require("crypto");
var Events:any = require("events");
var Util:any = require("util");
var Url:any = require("url");
var UA:any = require("universal-analytics");
var debug:any = require("debug")("ali-mns");
var Promise:any = require("promise");
var Request:{ new (input: RequestInfo, init?: RequestInit): Request; prototype: Request; } = require("request");
Request['requestP'] = Promise.denodeify(Request);
Request['debug'] = false;
var Xml2js:any = require("xml2js");
Xml2js.parseStringP = Promise.denodeify(Xml2js.parseString);
var XmlBuilder:any = require("xmlbuilder");
开发者ID:InCar,项目名称:ali-mns,代码行数:18,代码来源:ali-mns.ts
注:本文中的promise.denodeify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论