本文整理汇总了TypeScript中asyncblock.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
grunt.registerTask('familiar', 'familiar task', function() {
grunt.verbose.writeln('called familiar task');
var configs = defaultConfig();
var done = this.async();
asyncblock((flow) => {
for (var name in configs) {
var config = configs[name];
flow.sync(executeOtherTool(config, flow.callback()));
}
grunt.verbose.ok();
done();
});
});
示例2: User
app.post('/users', (req, res, next) => {
asyncblock((flow) => {
flow.errorCallback = next;
var userTemplate = req.body;
new User(userTemplate).validate().sync();
var user = User.create(userTemplate).sync();
res.send(201, { id: user.id });
});
});
示例3: getAmenderInputFromActTitles
static getAmenderInputFromActTitles (actTitles, done) { sync( flow => {
var actsInput = {}
actTitles.map( actTitle => {
logger.info('Getting id from title')
console.log (actTitle, actTitles)
var result: ActSeriesResult = ComLaw.getComLawIdFromActTitle(actTitle).sync(['seriesId', 'results'])
var id = result.results.acts[0].comLawId
logger.info('Scraping html')
var actData: ActData = ComLaw.downloadAct(id).sync()
console.log (actData)
actsInput[actTitle] = actData.data.html
})
done(null, actsInput)
})}
示例4: asyncblock
app.get('/users/:id', (req, res, next) => {
asyncblock((flow) => {
flow.errorCallback = next;
var id = req.param('id');
var user = User.findById(id).sync();
if (null === user) {
res.send(404);
} else {
res.status(200).send({
id: user.id,
name: user.name
});
}
});
});