本文整理汇总了TypeScript中Q.resolve函数的典型用法代码示例。如果您正苦于以下问题:TypeScript resolve函数的具体用法?TypeScript resolve怎么用?TypeScript resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: uploadFiles
function uploadFiles(files) {
var funcs = [];
files.forEach((file) => {
// replace backslash with forward slash
var srcPath = file.relative.replace(/\\/g,"/");
// strip out bad characters
var remotePath = srcPath.replace(/^\/|\/$/g, '') + ';'; // ';' needed to fix the url
funcs.push(() => {
try {
return bintray.uploadPackage(options.pkg.name, options.pkg.version, srcPath, remotePath)
.then((res) => {
_stream.push(file);
gutil.log(gutil.colors.yellow('Deployed ' + srcPath + ' to remote path ' + remotePath));
}, (err) => {
gutil.log(gutil.colors.red('Failed to deploy ' + srcPath + ' to remote path ' + remotePath + formatErr(err)));
throw err;
})
} catch(err) {
gutil.log(gutil.colors.red('Failed to deploy ' + srcPath + ' to remote path ' + remotePath + formatErr(err)));
return Q.reject(err);
}
});
});
var result = Q.resolve(true);
funcs.forEach((f) => {
result = result.then(() => { return f() }, (err) => { throw err; } );
});
return result;
}
开发者ID:frankwallis,项目名称:gulp-bintray,代码行数:33,代码来源:index.ts
示例2: test
test("setPlistProperty should attempt to modify, then add, plist properties", function() {
const plistFileName = "testFile.plist";
const plistProperty = ":RCTDevMenu:ExecutorClass";
const plistValue = "RCTWebSocketExecutor";
const setCallArgs = `/usr/libexec/PlistBuddy -c 'Set ${plistProperty} ${plistValue}' '${plistFileName}'`;
const addCallArgs = `/usr/libexec/PlistBuddy -c 'Add ${plistProperty} string ${plistValue}' '${plistFileName}'`;
const mockedExecFunc = sinon.stub();
mockedExecFunc.withArgs(setCallArgs).returns({ outcome: Q.reject(new Error("Setting does not exist")) });
mockedExecFunc.withArgs(addCallArgs).returns({ outcome: Q.resolve("stdout") });
mockedExecFunc.throws();
const mockChildProcess: any = {
exec: mockedExecFunc,
};
const plistBuddy = new PlistBuddy({ nodeChildProcess: mockChildProcess });
return plistBuddy.setPlistProperty(plistFileName, plistProperty, plistValue)
.then(() => {
assert(mockedExecFunc.calledWithExactly(setCallArgs), "plistBuddy did not attempt to set first");
assert(mockedExecFunc.calledWithExactly(addCallArgs), "plistBuddy did not attempt to add after set failed");
assert.equal(mockedExecFunc.callCount, 2);
});
});
开发者ID:Mokto,项目名称:vscode-react-native,代码行数:25,代码来源:plistBuddy.test.ts
示例3: updateNotifier
return Q.resolve().then(() => {
var defer = Q.defer();
if (notifier || !opts.getBoolean('enabled', true)) {
return Q.resolve(notifier);
}
// switch if we want to wait for this
var callback = (promise ? (err, update) => {
if (err) {
notifier = null;
defer.reject(err);
}
else {
notifier.update = update;
defer.resolve(notifier);
}
} : undefined);
var settings:any = {
packageName: context.packageInfo.name,
packageVersion: context.packageInfo.version,
updateCheckInterval: opts.getDurationSecs('updateCheckInterval', 24 * 3600) * 1000,
updateCheckTimeout: opts.getDurationSecs('updateCheckTimeout', 10) * 1000,
registryUrl: opts.getString('registryUrl'),
callback: callback
};
notifier = updateNotifier(settings);
if (!callback) {
defer.resolve(notifier);
}
return defer.promise;
});
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:32,代码来源:update.ts
示例4:
}).catch((error: HttpError) => {
// ignore network failures on timeout, server forgets on session timeout anyways
if (!error.statusCode) {
return Q.resolve<void>(undefined);
}
return Q.reject<void>(error);
}).finally(() => {
开发者ID:relution-io,项目名称:relution-sdk,代码行数:7,代码来源:http.ts
示例5:
.then(isRunning => {
if (isRunning) {
Log.logMessage("Attaching to running packager at port: " + port);
return Q.resolve<void>(void 0);
}
return this.remoteExtension.startPackager();
});
开发者ID:CarlosVV,项目名称:vscode-react-native,代码行数:7,代码来源:generalMobilePlatform.ts
示例6:
.then(({ data }) => {
if (get(data, 'user.username') == null) {
return Q.reject()
} else {
return Q.resolve(data)
}
})
开发者ID:rymizuki,项目名称:site-animechannel,代码行数:7,代码来源:index.ts
示例7:
.fail(function (err) {
console.error(err);
tl.debug('taskRunner fail');
gradleResult = -1;
statusFailed = true;
return Q.resolve(err);
})
开发者ID:mthalman-msft,项目名称:vsts-tasks,代码行数:7,代码来源:gradletask.ts
示例8: RangeError
return this.getReactNativeVersion().then(version => {
if (semver.gte(version, "0.19.0")) {
return Q.resolve<void>(void 0);
} else {
return Q.reject<void>(new RangeError(`Project version = ${version}`));
}
});
开发者ID:CarlosVV,项目名称:vscode-react-native,代码行数:7,代码来源:reactNativeProjectHelper.ts
示例9: enableCodeCoverage
// -----------------------------------------------------
// Enable code coverage for Jacoco Gradle Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;
tl.debug("Input parameters: " + JSON.stringify(ccProps));
_this.buildFile = ccProps["buildfile"];
let classFilter = ccProps["classfilter"];
let isMultiModule = ccProps["ismultimodule"] && ccProps["ismultimodule"] === "true";
let classFileDirs = ccProps["classfilesdirectories"];
let reportDir = ccProps["reportdirectory"];
let codeCoveragePluginData = null;
let filter = _this.extractFilters(classFilter);
let jacocoExclude = _this.applyFilterPattern(filter.excludeFilter);
let jacocoInclude = _this.applyFilterPattern(filter.includeFilter);
if (isMultiModule) {
codeCoveragePluginData = ccc.jacocoGradleMultiModuleEnable(jacocoExclude.join(","), jacocoInclude.join(","), classFileDirs, reportDir);
} else {
codeCoveragePluginData = ccc.jacocoGradleSingleModuleEnable(jacocoExclude.join(","), jacocoInclude.join(","), classFileDirs, reportDir);
}
try {
tl.debug("Code Coverage data will be appeneded to build file: " + this.buildFile);
util.appendTextToFileSync(this.buildFile, codeCoveragePluginData);
tl.debug("Appended code coverage data");
} catch (error) {
tl.warning(tl.loc("FailedToAppendCC", error));
return Q.reject<boolean>(tl.loc("FailedToAppendCC", error));
}
return Q.resolve<boolean>(true);
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:36,代码来源:jacoco.gradle.ccenabler.ts
示例10: addCodeCoverageNodes
protected addCodeCoverageNodes(buildJsonContent: any): Q.Promise<any> {
let _this = this;
let buildNode = _this.getBuildDataNode(buildJsonContent);
let pluginsNode = _this.getPluginDataNode(buildNode);
let ccContent = ccc.jacocoMavenPluginEnable(_this.includeFilter, _this.excludeFilter, _this.reportDir);
util.addPropToJson(pluginsNode, "plugin", ccContent);
return Q.resolve(buildJsonContent);
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:9,代码来源:jacoco.maven.ccenabler.ts
注:本文中的Q.resolve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论