本文整理汇总了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);
});
示例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);
}
});
示例3: setTimeout
setTimeout(function(): void {
console.log(`async.forEachOfLimit: ${key} = ${val}`);
next();
}, 500);
示例4: next
() => {
console.log(`async.forEachOfLimit: ${key} = ${val}`);
next();
},
示例5: setTimeout
setTimeout(() => {
console.log(`async.eachLimit: ${val}`);
next();
},
示例6: cb
runTest(contractName, contracts[contractName], contractsToTestDetails[index], { accounts }, _testCallback, (err, result) => {
if (err) {
return cb(err)
}
_resultsCallback(null, result, cb)
})