本文整理匯總了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
});
}
});
});