本文整理汇总了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);
}
});
});
}
示例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");