当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript async.series函数代码示例

本文整理汇总了TypeScript中async.series函数的典型用法代码示例。如果您正苦于以下问题:TypeScript series函数的具体用法?TypeScript series怎么用?TypeScript series使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了series函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: join

        cb => async.each(packs, (pack, next2) => {
          const dir = join(assetsDir, pack.id);

          if (pack.mode === 'images') {
            linkDirs(resolve(pack.path, pack.images.directory), dir, next2);
          } else if (pack.mode === 'sprite') {
            const filename = basename(pack.sprite.file);
            async.series([
              cb2 => mkdirp(dir, cb2),
              cb2 => copy(resolve(pack.path, pack.sprite.file), join(dir, filename), cb2),
            ], next2);
          } else { // pack.mode === 'font'
            const fontFiles = [
              pack.font.eot,
              pack.font.svg,
              pack.font.woff,
              pack.font.ttf,
              pack.font.woff2,
            ].filter(Boolean);

            async.series([
              cb2 => mkdirp(dir, cb2),
              cb2 => async.each(fontFiles, (file, next3) => {
                const filename = basename(file);
                copy(resolve(pack.path, file), join(dir, filename), next3);
              }, cb2),
            ], next2);
          }
        }, cb),
开发者ID:julianlam,项目名称:nodebb-plugin-emoji,代码行数:29,代码来源:build.ts

示例2: function

    syncPlugins: function (portalApi: ApiDescription, kongApi: KongApiConfig, callback: ErrorCallback): void {
        debug('syncPlugins()');
        const todoLists = assemblePluginTodoLists(portalApi, kongApi);
        //debug(utils.getText(todoLists));
        debug('Infos on sync API Plugins todo list:');
        debug('  add items: ' + todoLists.addList.length);
        debug('  update items: ' + todoLists.updateList.length);
        debug('  delete items: ' + todoLists.deleteList.length);

        /*
        debug('portalApi');
        debug(portalApi);
        debug('kongApi');
        debug(kongApi);
        */

        async.series({
            addPlugins: function (callback) {
                kong.addKongPlugins(todoLists.addList, callback);
            },
            updatePlugins: function (callback) {
                kong.updateKongPlugins(todoLists.updateList, callback);
            },
            deletePlugins: function (callback) {
                kong.deleteKongPlugins(todoLists.deleteList, callback);
            }
        }, function (err) {
            if (err)
                return callback(err);
            debug("sync.syncPlugins() done.");
            return callback(null);
        });
    },
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:33,代码来源:sync.ts

示例3: syncConsumers

function syncConsumers(portalConsumers: ConsumerInfo[], kongConsumers: ConsumerInfo[], callback: ErrorCallback) {
    if (portalConsumers.length === 0 && kongConsumers.length === 0) {
        debug('syncConsumers() - nothing to do (empty consumer lists).');
        setTimeout(callback, 0);
        return;
    }
    debug('syncConsumers()');
    debug('syncConsumers(): Creating Todo lists.');
    const todoLists = assembleConsumerTodoLists(portalConsumers, kongConsumers);
    debug('Infos on sync consumers todo list:');
    debug('  add items: ' + todoLists.addList.length);
    debug('  update items: ' + todoLists.updateList.length);
    debug('  delete items: ' + todoLists.deleteList.length);

    async.series({
        addConsumers: callback => kong.addKongConsumers(todoLists.addList, callback),
        updateConsumers: callback => kong.updateKongConsumers(sync, todoLists.updateList, callback), // Will call syncConsumerApiPlugins
        deleteConsumers: callback => kong.deleteKongConsumers(todoLists.deleteList, callback)
    }, function (err, results) {
        if (err)
            return callback(err);
        info('syncConsumers() done.');
        return callback(null);
    });
}
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:25,代码来源:sync.ts

示例4: dispatchWebhookAction

function dispatchWebhookAction(webhookData, onlyDelete, callback) {
    debug('dispatchWebhookAction()');
    const action = webhookData.action;
    const entity = webhookData.entity;
    info(`Process action ${action} for entity ${entity}`);
    let syncAction = null;
    if (entity === 'application' && (action === 'add' || action === 'update') && !onlyDelete)
        syncAction = callback => syncAppConsumers(webhookData.data.applicationId, callback);
    else if (entity === 'application' && action === 'delete')
        syncAction = callback => deleteAppConsumers(webhookData.data.applicationId, webhookData.data.subscriptions, callback);
    else if (entity === 'subscription' && (action === 'add' || action === 'update') && !onlyDelete)
        syncAction = callback => syncAppConsumers(webhookData.data.applicationId, callback);
    else if (entity === 'subscription' && action === 'delete')
        syncAction = callback => deleteAppSubscriptionConsumer(webhookData.data, callback);
    else
        debug(`Discarding event ${action} ${entity}.`)

    async.series([
        callback => {
            if (syncAction)
                return syncAction(callback);
            return callback(null);
        },
        callback => acknowledgeEvent(webhookData.id, callback)
    ], function (err) {
        if (err) {
            error('SYNC ACTION FAILED!');
            error(err);
            return callback(err);
        }
        debug(`dispatchWebhookAction successfully returned for action ${action} ${entity}`);
        callback(null);
    });
}
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:34,代码来源:main.ts

示例5: function

PullRequest.prototype.close = function(opt_callback) {
    const instance = this
    const options = instance.options
    let operations
    let pull

    operations = [
        function(callback) {
            instance.getPullRequest_((err, data) => {
                if (!err) {
                    pull = data
                }
                callback(err)
            })
        },
        function(callback) {
            instance.updatePullRequest_(pull.title, pull.body, PullRequest.STATE_CLOSED, callback)
        },
        function(callback) {
            if (options.pullBranch === options.currentBranch) {
                git.checkout(pull.base.ref)
            }

            if (options.pullBranch) {
                git.deleteBranch(options.pullBranch)
            }

            callback()
        },
    ]

    async.series(operations, err => {
        opt_callback && opt_callback(err, pull)
    })
}
开发者ID:gamerson,项目名称:gh,代码行数:35,代码来源:pull-request.ts

示例6: before

  before(function(done) {
    async.series(
      [
        // Remove buckets created for the tests.
        deleteBuckets,

        // Remove datasets created for the tests.
        deleteDatasets,

        // Create the test dataset with a label tagging this as a test run.
        dataset.create.bind(dataset, {
          labels: [{[GCLOUD_TESTS_PREFIX]: ''}]
        }),

        // Create the test table.
        table.create.bind(table, {
          schema: SCHEMA,
        }),

        // Create a Bucket.
        bucket.create.bind(bucket),
      ],
      done
    );
  });
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:25,代码来源:bigquery.ts

示例7: AddContentDependency

    public AddContentDependency(inData, cb) {

        var dataAccessLayerX = new dalxpooled.DataAccessLayerX();

        var jsonObjectToReturn:any = {};

        async.series([
                function(cb) {
                    dataAccessLayerX.openConnection(function(err) {
                        cb(err, null);
                    });
                },
                function(cb) {
                    dataAccessLayerX.addContentDependency(inData.contentdependency, function(err, result) {
                        jsonObjectToReturn.contentdependencyid = result.insertId;
                        cb(err, null);
                    });
                }
            ],
            function(err, results) {
                dataAccessLayerX.closeConnection();
                if (err) {
                    logger.log('error', arguments.callee.toString(), err);
                    console.log(err);
                    console.trace();
                    cb(err, false, null);
                }
                else {
                    cb(null, true, jsonObjectToReturn);
                }
            }
        );

    };
开发者ID:siliconplains44,项目名称:ldcontentstorm,代码行数:34,代码来源:bl.ts

示例8: function

 getAppConsumers: function (appId, callback: Callback<ConsumerInfo[]>) {
     debug('getPortalConsumersForApp() ' + appId);
     const applicationList = [{ id: appId, ownerList: [], name: appId }];
     let apiPlans: WickedApiPlanCollection = null;
     let apiList: ApiDescriptionCollection = null;
     async.series({
         plans: callback => utils.getPlans(function (err, apiPlans_: WickedApiPlanCollection) {
             if (err)
                 return callback(err);
             apiPlans = apiPlans_;
             return callback(null);
         }),
         apis: callback => getActualApis(function (err, apiList_: ApiDescriptionCollection) {
             if (err)
                 return callback(err);
             apiList = apiList_;
             return callback(null);
         }),
         appConsumers: callback => enrichApplications(applicationList, apiPlans, apiList, callback)
         // (apiPlans, callback) => enrichApplications(applicationList, apiPlans, callback)
     }, function (err, results) {
         if (err)
             return callback(err);
         callback(null, results.appConsumers);
     });
 },
开发者ID:Haufe-Lexware,项目名称:wicked.portal-kong-adapter,代码行数:26,代码来源:portal.ts

示例9: migrateTo1

function migrateTo1(server: ProjectServer, callback: (err: Error) => any) {
  const assetsPath = path.join(server.projectPath, "assets");

  async.series([
    // Delete ArcadePhysics2DSettingsResource, removed in Superpowers v0.13
    // FIXME: This should be done by an init function in the plugin, probably.
    (cb) => { fs.unlink(path.join(server.projectPath, "resources/arcadePhysics2DSettings/resource.json"), (err) => { cb(); }); },
    (cb) => { fs.rmdir(path.join(server.projectPath, "resources/arcadePhysics2DSettings"), (err) => { cb(); }); },

    // Move trashed assets to "trashedAssets" folder
    (cb) => {
      fs.readdir(assetsPath, (err, assetFolders) => {
        if (err != null) throw err;

        const assetFolderRegex = /^[0-9]+-.+$/;
        const trashedAssetFolders: string[] = [];
        for (const assetFolder of assetFolders) {
          if (!assetFolderRegex.test(assetFolder)) continue;

          const assetId = assetFolder.substring(0, assetFolder.indexOf("-"));
          if (server.data.entries.byId[assetId] == null) trashedAssetFolders.push(assetFolder);
        }

        async.each(trashedAssetFolders, server.moveAssetFolderToTrash.bind(server), cb);
      });
    },

    // Delete internals.json and members.json
    (cb) => { fs.unlink(path.join(server.projectPath, "internals.json"), (err) => { cb(); }); },
    (cb) => { fs.unlink(path.join(server.projectPath, "members.json"), (err) => { cb(); }); }
  ], callback);
}
开发者ID:alphafork,项目名称:Game-Engine-superpowers-core,代码行数:32,代码来源:migrateProject.ts


注:本文中的async.series函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。