本文整理汇总了TypeScript中async.eachSeries函数的典型用法代码示例。如果您正苦于以下问题:TypeScript eachSeries函数的具体用法?TypeScript eachSeries怎么用?TypeScript eachSeries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eachSeries函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: callback
utils.kongGetAllApis(function (err, rawApiList) {
if (err)
return callback(err);
let apiList: KongApiConfigCollection = {
apis: []
};
// Add an "api" property for the configuration, makes it easier
// to compare the portal and Kong configurations.
for (let i = 0; i < rawApiList.data.length; ++i) {
apiList.apis.push({
api: rawApiList.data[i]
});
}
// Fire off this sequentially, not in parallel (renders 500's sometimes)
async.eachSeries(apiList.apis, function (apiDef: KongApiConfig, callback) {
utils.kongGetApiPlugins(apiDef.api.id, function (err, apiConfig) {
if (err)
return callback(err);
apiDef.plugins = apiConfig.data;
return callback(null);
});
}, function (err) {
if (err)
return callback(err);
// Plugins which are referring to consumers are not global, and must not be taken
// into account when comparing.
apiList = removeKongConsumerPlugins(apiList);
return callback(null, apiList);
});
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:35,代码来源:kong.ts
示例2: function
addKongApis: function (addList: AddApiItem[], done): void {
// Bail out early if list empty
if (addList.length === 0) {
setTimeout(done, 0);
return;
}
debug('addKongApis()');
// Each item in addList contains:
// - portalApi: The portal's API definition, including plugins
async.eachSeries(addList, function (addItem: AddApiItem, callback) {
info(`Creating new API in Kong: ${addItem.portalApi.id}`);
utils.kongPostApi(addItem.portalApi.config.api, function (err, apiResponse) {
if (err)
return done(err);
const kongApi = { api: apiResponse };
debug(kongApi);
const addList = [];
for (let i = 0; i < addItem.portalApi.config.plugins.length; ++i) {
addList.push({
portalApi: addItem,
portalPlugin: addItem.portalApi.config.plugins[i],
kongApi: kongApi,
});
}
kong.addKongPlugins(addList, callback);
});
}, function (err) {
if (err)
return done(err);
done(null);
});
},
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:33,代码来源:kong.ts
示例3: mergeAverageDownloadsPerDay
mergeAverageDownloadsPerDay(packages, (error, packages) => {
if (error) return callback(error);
logger.debug('updating with %d packages (%s)', packages.length, updates_only ? 'updates only' : 'all packages');
var batches = _.chunk(packages, 500);
async.eachSeries(batches, insertPackages, callback);
});
开发者ID:chbrown,项目名称:npm-search-server,代码行数:7,代码来源:database.ts
示例4: function
wicked.getWebhookEvents('kong-adapter', function (err, pendingEvents) {
if (err) {
error('COULD NOT RETRIEVE WEBHOOKS')
return callback(err);
}
const duration = (new Date().getTime() - now);
debug(`processPendingWebhooks: Retrieved ${pendingEvents.length} events in ${duration}ms`);
const onlyDelete = false;
if (pendingEvents.length === 0)
return callback(null, false);
async.eachSeries(pendingEvents, (webhookData: WickedEvent, callback) => {
const now = new Date().getTime();
dispatchWebhookAction(webhookData, onlyDelete, function (err) {
const duration = (new Date().getTime() - now);
debug(`processPendingWebhooks: Processed ${webhookData.action} ${webhookData.entity} event in ${duration}ms`);
if (err)
return callback(err);
return callback(null);
});
}, function (err) {
if (err) {
error('An error occurred during dispatching events.');
error(err);
return callback(err);
}
return callback(null, true);
});
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:29,代码来源:main.ts
示例5: return
return (dispatch, getState) => {
var globalState: GlobalStoreDataType = getState();
var repos = globalState.git.get("repos").toArray();
const fetchCommits = (item: Repo, callback: Function) => {
const onSuccess = () => {
// callback();
}
dispatch(getCommits(item, onSuccess))
}
const onFinish = (errorCode: Error) => {
alert("success");
}
async.eachSeries(repos, fetchCommits, onFinish)
}
开发者ID:SSE-13,项目名称:homework-reporter,代码行数:26,代码来源:actions.ts
示例6: windows_find_java_home
/**
* Find Java on Windows by checking registry keys.
*/
function windows_find_java_home(grunt: IGrunt, cb: (success: boolean, java_home?: string, append_exe?: boolean) => void): void {
// Windows: JDK path is in either of the following registry keys:
// - HKLM\Software\JavaSoft\Java Development Kit\1.[version] [JDK arch == OS arch]
// - HKLM\Software\Wow6432Node\JavaSoft\Java Development Kit\1.[version] [32-bit JDK Arch, 64-bit OS arch]
// Check both for Java 6, 7, and 8.
var keys_to_check: string[] = [
'HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6',
'HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit\\1.6',
'HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7',
'HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit\\1.7',
'HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8',
'HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit\\1.8'
];
async.eachSeries(keys_to_check, (key: string, iterator_cb: (java_home?: string) => void) => {
get_registry_key(key, (err: Error, values?: { [valName: string]: string }) => {
if (err || !values['JavaHome']) {
iterator_cb();
} else {
iterator_cb(values['JavaHome']);
}
});
}, (java_home?: string): void => {
if (java_home) {
cb(true, java_home, true);
} else {
cb(false);
}
});
}
开发者ID:chubbymaggie,项目名称:doppio,代码行数:32,代码来源:find_native_java.ts
示例7: process
process(done: () => void) {
// preprocess
for (let name in this.sql.statements) {
this.sql.statements[name].name = name;
}
for (let name in this.sql.tokens) {
this.sql.tokens[name].name = name;
}
for (let name in this.sql.dialects) {
this.sql.dialects[name].name = name;
}
var csg = new cs(this);
var javag = new java(this);
var nodeg = new node(this);
async.eachSeries([csg, javag, nodeg],
(generator, cb) => {
generator.generate(() => {
cb(null);
});
}, () => {
console.log("done");
process.exit(0);
});
}
开发者ID:ttrider,项目名称:fluid-sql,代码行数:27,代码来源:project.ts
示例8: init
function init() {
if (!fs.existsSync(rootPath)) {
return;
}
console.log('init------start ');
let fileList: string[] = fs.readdirSync(rootPath);
docsLoadingState = false;
asyncjs.eachSeries(fileList, (file, callback) => {
if (!fs.statSync(rootPath + file).isDirectory()) {
return callback(null);
}
fs.readFile(rootPath + file + '/db.json', { encoding: 'utf-8' }, (err, data) => {
if (err) {
console.log('load file ' + file + 'error:' + err);
} else {
docsDB[file] = JSON.parse(data);
}
callback(null);
});
}, err => {
if (!err) {
docsLoadingState = true;
}
console.log('init------end ');
});
}
开发者ID:snippetmodule,项目名称:docs-search-client,代码行数:26,代码来源:docs.ts
示例9: getImagesInFolder
function getImagesInFolder(dir: string, imgInFolderCb: Function): void {
let files = fs.readdirSync(dir);
let images: number[][] = [];
async.eachSeries(files,
function(file: string, asyncCallback: Function) {
jimp.read(dir + file, function (err: any, img: any) {
if (err) throw err;
images.push(img.bitmap.data);
process.stdout.write('.');
// img.scan(0, 0, img.bitmap.width, img.bitmap.height, function (x: number, y: number, idx: number) {
// // x, y is the position of this pixel on the image
// // idx is the position start position of this rgba tuple in the bitmap Buffer
// // this is the image
//
// imgPixels.push(this.bitmap.data[idx]); // Red
// imgPixels.push(this.bitmap.data[idx + 1]); // Green
// imgPixels.push(this.bitmap.data[idx + 2]); // Blue
//
// // rgba values run from 0 - 255
// // e.g. this.bitmap.data[idx] = 0; // removes red from this pixel
// });
// images[index] = imgPixels;
asyncCallback();
});
},
function(err: any){
if (err) throw err;
imgInFolderCb(null, images);
}
);
}
开发者ID:,项目名称:,代码行数:33,代码来源:
示例10: migrateTo3
function migrateTo3(server: ProjectServer, callback: (err: Error) => any) {
const assetsPath = path.join(server.projectPath, "assets");
async.eachSeries(Object.keys(server.data.entries.byId), (nodeId, cb) => {
const node = server.data.entries.byId[nodeId];
const storagePath = server.data.entries.getStoragePathFromId(nodeId);
if (node.type == null) cb();
else {
const index = storagePath.lastIndexOf("/");
let parentStoragePath = storagePath;
const oldStoragePath = path.join(assetsPath, `${nodeId}-${server.data.entries.getPathFromId(nodeId).replace(new RegExp("/", "g"), "__")}`);
if (index !== -1) {
parentStoragePath = storagePath.slice(0, index);
mkdirp(path.join(assetsPath, parentStoragePath), (err) => {
if (err != null && err.code !== "EEXIST") { cb(err); return; }
fs.rename(oldStoragePath, path.join(assetsPath, storagePath), cb);
});
} else {
fs.rename(oldStoragePath, path.join(assetsPath, storagePath), cb);
}
}
}, callback);
}
开发者ID:alphafork,项目名称:Game-Engine-superpowers-core,代码行数:25,代码来源:migrateProject.ts
示例11: callback
utils.kongGetLegacyApis(function (err, legacyApis) {
if (err)
return callback(err);
async.eachSeries(legacyApis.data, (legacyApi, callback) => {
info(`Deleting Legacy Kong API ${legacyApi.name}.`);
utils.kongDeleteLegacyApi(legacyApi.name, callback);
}, callback);
});
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:8,代码来源:sync.ts
示例12: addKongConsumerPlugin
function addKongConsumerPlugin(consumerId: string, pluginName: string, pluginDataList: ConsumerPlugin[], done) {
debug('addKongConsumerPlugin()');
async.eachSeries(pluginDataList, function (pluginData: ConsumerPlugin, callback) {
info(`Adding consumer plugin ${pluginName} for consumer ${consumerId}`);
utils.kongPostConsumerPlugin(consumerId, pluginName, pluginData, callback);
}, function (err) {
if (err)
return done(err);
done(null);
});
}
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:11,代码来源:kong.ts
示例13: return
return (req: Request, res: Response, next: NextFunction) => {
if (Array.isArray(fun) === true) {
return eachSeries(fun as RequestHandler[], (f, cb) => {
Promise.resolve(f(req, res, cb))
.catch(err => next(err))
}, next)
}
return Promise.resolve((fun as RequestHandler)(req, res, next))
.catch(err => next(err))
}
开发者ID:quoidautre,项目名称:PeerTube,代码行数:11,代码来源:async.ts
示例14: deleteKongConsumerPlugin
function deleteKongConsumerPlugin(consumerId, pluginName, pluginDataList, done) {
debug('deleteKongConsumerPlugin()');
async.eachSeries(pluginDataList, function (pluginData, callback) {
info(`Deleting consumer plugin ${pluginName} for consumer ${consumerId}`);
utils.kongDeleteConsumerPlugin(consumerId, pluginName, pluginData.id, callback);
}, function (err) {
if (err)
return done(err);
done(null);
});
}
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:11,代码来源:kong.ts
示例15: symlink_java_home
function symlink_java_home(grunt: IGrunt, cb: (err?: any) => void): void {
var java_home: string = 'vendor/java_home',
JH: string,
links;
if (fs.existsSync(java_home)) {
return cb();
}
grunt.config.requires('build.scratch_dir');
JH = path.resolve(grunt.config('build.scratch_dir'), 'usr', 'lib', 'jvm', 'java-6-openjdk-i386', 'jre'),
// a number of .properties files are symlinks to /etc; copy the targets over
// so we do not need to depend on /etc's existence
links = find_symlinks(JH);
async.eachSeries(links, function(link, cb2){
try {
var dest = fs.readlinkSync(link);
if (dest.match(/^\/etc/)) {
ncp(path.join(grunt.config('build.scratch_dir'), dest), link, function(err?: any) {
if (err) {
// Some /etc symlinks are just broken. Hopefully not a big deal.
grunt.log.writeln('warning: broken symlink: ' + dest);
}
cb2(null);
});
} else {
var p = path.resolve(path.join(path.dirname(link), dest));
// copy in anything that links out of the JH dir
if (!p.match(/java-6-openjdk-i386/)) {
// XXX: this fails if two symlinks reference the same file
if (fs.statSync(p).isDirectory()) {
fs.unlinkSync(link);
}
ncp(p, link, function(err?: any) {
if (err) {
grunt.log.writeln('warning: broken symlink: ' + p);
}
cb2(null);
});
} else {
// Nothing to do.
cb2(null);
}
}
} catch (e) {
grunt.log.writeln('warning: broken symlink: ' + link);
cb2(null);
}
}, function(err){
ncp(JH, java_home, function(err2?: any) {
err2 = err2 ? err2 : err;
cb(err2);
});
});
}
开发者ID:realface,项目名称:doppio,代码行数:53,代码来源:setup_java_home.ts
示例16: takeScreenshot
.perform((client, done) => {
async.eachSeries(viewports, (width, next) => {
client.resizeWindow(width, 5000).pause(1000)
.perform((client, done) => {
takeScreenshot(client,
`STAGING-${imageModFunc(slug, width)}`
).then(() => { next(); done(); });
})
});
next();
done();
});
开发者ID:DonPage,项目名称:webpage-diff,代码行数:12,代码来源:diff.ts
示例17: function
publish: function () {
cb = last(arguments);
const messages = (Array.isArray(arguments[0])) ? arguments[0] : Array.prototype.slice.call(arguments, 0, -1);
async.eachSeries(messages, (message, next) => {
const str = (isObject(message)) ? JSON.stringify(message) : message;
connection.publish(topic, "", str, {
deliveryMode: 2,
confirm: true,
}, next);
}, cb);
},
开发者ID:tcdl,项目名称:msb,代码行数:12,代码来源:amqpPublisher.ts
示例18: compareImages
async.eachSeries(urlArray, (slug, nextSlug) => {
async.eachSeries(viewports, (width, nextWidth) => {
compareImages(`PRODUCTION-${imageModFunc(slug, width)}`, `STAGING-${imageModFunc(slug, width)}`, res => {
console.log(`
---------------------------------
| Page: ${slug} @ ${width} px
| Same: ${res}
---------------------------------
`);
nextWidth();
});
}, () => nextSlug())
}, () => client.end())
开发者ID:DonPage,项目名称:webpage-diff,代码行数:13,代码来源:diff.ts
示例19: updateKongConsumerPlugins
function updateKongConsumerPlugins(portalConsumer: ConsumerInfo, kongConsumer: ConsumerInfo, callback: ErrorCallback) {
debug('updateKongConsumerPlugins() for ' + portalConsumer.consumer.username);
async.eachSeries(CONSUMER_PLUGINS, function (pluginName: string, callback) {
debug("Checking Consumer plugin '" + pluginName + "'.");
let portalHasPlugin = !!portalConsumer.plugins[pluginName];
let kongHasPlugin = !!kongConsumer.plugins[pluginName];
if (portalHasPlugin && !kongHasPlugin) {
// Add Plugin
let portalPlugin = portalConsumer.plugins[pluginName];
return addKongConsumerPlugin(kongConsumer.consumer.id, pluginName, portalPlugin, callback);
} else if (!portalHasPlugin && kongHasPlugin) {
// Delete Plugin
let kongPlugin = kongConsumer.plugins[pluginName];
return deleteKongConsumerPlugin(kongConsumer.consumer.id, pluginName, kongPlugin, callback);
} else if (portalHasPlugin && kongHasPlugin) {
// Update Plugin
let portalPlugin = portalConsumer.plugins[pluginName];
let kongPlugin = kongConsumer.plugins[pluginName];
if (!utils.matchObjects(portalPlugin, kongPlugin)) {
async.series({
deletePlugin: function (innerCallback) {
deleteKongConsumerPlugin(kongConsumer.consumer.id, pluginName, kongPlugin, innerCallback);
},
addPlugin: function (innerCallback) {
addKongConsumerPlugin(kongConsumer.consumer.id, pluginName, portalPlugin, innerCallback);
}
}, function (err2, results) {
if (err2)
return callback(err2);
debug("updateKongConsumerPlugins - Update finished.");
return callback(null);
});
} else {
// This is a synchronuous call inside async, which assumes it is asynchronuous. process.nextTick defers
// execution until the next tick, so that this also gets async. If you don't do this, you will fairly
// easily end up in a 'RangeError: Maximum call stack size exceeded' error.
return process.nextTick(callback);
}
// Nothing to do here.
} else { // Else: Plugin not used for consumer
// See above regarding process.nextTick()
return process.nextTick(callback);
}
}, function (err) {
if (err)
return callback(err);
debug("updateKongConsumerPlugins() finished.");
callback(null);
});
}
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:51,代码来源:kong.ts
示例20: function
fs.readFile(filePath, {encoding: 'utf-8'}, function(err, data){
if (err) {
console.error(`ERROR opening JSON '${filePath}': `, err)
return cbJson(err)
}
console.error(`Opening JSON '${filePath}'`)
let obj: any = JSON.parse(data)
let docs: any[] = _.get(obj, "value",[])
nModelDocs = 0
let processDocForModel = _.curry(processDoc)(model)
let summaryForModel = _.curryRight(summary)(modelName)
async.eachSeries(docs, processDocForModel, summaryForModel)
})
开发者ID:szabof1,项目名称:json2mongo,代码行数:16,代码来源:initMongoDbDatabase.ts
注:本文中的async.eachSeries函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论