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