本文整理汇总了TypeScript中p-all类的典型用法代码示例。如果您正苦于以下问题:TypeScript p-all类的具体用法?TypeScript p-all怎么用?TypeScript p-all使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了p-all类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: buildDemos
function buildDemos(filePaths: string[]) {
const functions = filePaths.map(filePath => () => {
return buildDemo(filePath);
});
let concurrentNumber = 2;
if (argv.concurrency) {
concurrentNumber = argv.concurrency;
}
return pAll(functions, {concurrency: concurrentNumber});
}
示例2: buildTests
function buildTests(filePaths: string[]) {
const functions = filePaths.map(filePath => () => {
return buildTest(filePath);
});
// Run 2 tests at a time unless the `concurrency` arg is passed
let concurrentNumber = 2;
if (argv.concurrency) {
concurrentNumber = argv.concurrency;
}
return pAll(functions, {concurrency: concurrentNumber}).then(() => {
// copy over all of the protractor tests to the correct location now
return copyProtractorTestContent(filePaths);
});
}
示例3: buildDemos
function buildDemos(filePaths: string[]) {
var batches = chunkArrayInGroups(filePaths, argv.batches || 1);
var batch = argv.batch || 0;
if(batch >= batches.length) {
throw new Error(`Batch number higher than total number of batches.`);
}
console.log(`Compiling ${batches[batch].length} of ${filePaths.length} Demos ...`);
const functions = batches[batch].map(filePath => () => {
return buildDemo(filePath);
});
let concurrentNumber = 2;
if (argv.concurrency) {
concurrentNumber = argv.concurrency;
}
return pAll(functions, {concurrency: concurrentNumber});
}