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