如何实现一个异步设置body的问题 ~~·
app.use(function*() {
setTimeout(function(){
// 在这里设置body
this.body = '111111'
}.bind(this),1000)
});
如何实现一个异步设置body的问题 ~~·
app.use(function*() {
setTimeout(function(){
// 在这里设置body
this.body = '111111'
}.bind(this),1000)
});
app.use(function*() {
var _this=this;
setTimeout(function(){
// 在这里设置body
this.body = '111111'
}.bind(this),1000)
});
app.use(function*() {
yield function(cb){
setTimeout(function(){
cb();
this.body = 100
}.bind(this),1000)
};
});
3 回答2.6k 阅读✓ 已解决
1 回答915 阅读✓ 已解决
3 回答2.4k 阅读✓ 已解决
2 回答1.2k 阅读
1 回答872 阅读✓ 已解决
2 回答1.6k 阅读
2 回答601 阅读✓ 已解决
app.use(function*() {
});
看懂Co框架的实现才能弄懂koa回调的原理