當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。