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


TypeScript async.ErrorCallback类代码示例

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


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

示例1: function

 fs.readdir(dir, function (err, items) {
   
   if (err) {
     log.warning('warning: fs error while creating suman markers map.');
     log.warning('warning: ' + err.message);
     return cb(null);
   }
   
   items = items.map(function (item) {
     return path.resolve(dir, item);
   });
   
   async.eachLimit(items as any, 5, function (item: string, cb: ErrorCallback<any>) {
     
     if (sumanHelpersDirRegex.test(item)) {
       return process.nextTick(cb);
     }
     
     fs.stat(item, function (err, stats) {
       
       if (err) {
         log.warning('warning: fs error while creating suman markers map.');
         log.warning('warning:' + err.message);
         return cb(null);
       }
       
       if (stats.isFile()) {
         addItem(item);
         cb(null);
       }
       else if (stats.isDirectory()) {
         //TODO: stop here if this item is deeper than any of the files passed in
         if (!/node_modules/.test(String(item)) && !/\/.git\//.test(String(item))) {
           addItem(item);
           getMarkers(item, cb);
         }
         else {
           log.warning(`warning: node_modules/.git path ignored => "${item}".`);
           cb(null);
         }
       }
       else {
         log.warning('warning: fs error while creating suman markers map.');
         log.warning(`warning: not directory or file => "${item}".`);
         log.warning(`warning: possibly a symlink (symlinks not yet supported) => "${item}".`);
         cb(null);
       }
       
     });
     
   }, cb);
   
 });
开发者ID:ORESoftware,项目名称:suman-utils,代码行数:53,代码来源:index.ts

示例2: cb

 fs.stat(item, function (err, stats) {
   
   if (err) {
     log.warning('warning: fs error while creating suman markers map.');
     log.warning('warning:' + err.message);
     return cb(null);
   }
   
   if (stats.isFile()) {
     addItem(item);
     cb(null);
   }
   else if (stats.isDirectory()) {
     //TODO: stop here if this item is deeper than any of the files passed in
     if (!/node_modules/.test(String(item)) && !/\/.git\//.test(String(item))) {
       addItem(item);
       getMarkers(item, cb);
     }
     else {
       log.warning(`warning: node_modules/.git path ignored => "${item}".`);
       cb(null);
     }
   }
   else {
     log.warning('warning: fs error while creating suman markers map.');
     log.warning(`warning: not directory or file => "${item}".`);
     log.warning(`warning: possibly a symlink (symlinks not yet supported) => "${item}".`);
     cb(null);
   }
   
 });
开发者ID:ORESoftware,项目名称:suman-utils,代码行数:31,代码来源:index.ts

示例3: setTimeout

    setTimeout(function(): void {

        console.log(`async.forEachOfLimit: ${key} = ${val}`);

        next();

    }, 500);
开发者ID:LaurensRietveld,项目名称:DefinitelyTyped,代码行数:7,代码来源:index.ts

示例4: next

 () => {
     console.log(`async.forEachOfLimit: ${key} = ${val}`);
     next();
 },
开发者ID:DefinitelyTyped,项目名称:DefinitelyTyped,代码行数:4,代码来源:index.ts

示例5: setTimeout

 setTimeout(() => {
     console.log(`async.eachLimit: ${val}`);
     next();
 },
开发者ID:DefinitelyTyped,项目名称:DefinitelyTyped,代码行数:4,代码来源:index.ts

示例6: cb

 runTest(contractName, contracts[contractName], contractsToTestDetails[index], { accounts }, _testCallback, (err, result) => {
     if (err) {
         return cb(err)
     }
     _resultsCallback(null, result, cb)
 })
开发者ID:0mkara,项目名称:remix,代码行数:6,代码来源:runTestSources.ts


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