controller/topic.js异步协作问题
var events = [ 'topic', 'other_topics', 'no_reply_topics', 'get_relation', '[@user](/user/user)'];
var events = [ 'topic', 'other_topics', 'no_reply_topics', 'get_relation', '[@user](/user/user)'];
var ep = EventProxy.create(events, function (topic, other_topics, no_reply_topics, relation) {
res.render('topic/index', {
topic: topic,
author_other_topics: other_topics,
no_reply_topics: no_reply_topics,
relation : relation
});
});
ep.once('topic', function (topic) {
if (topic.content_is_html) {
return ep.emit('[@user](/user/user)');
}
at_ctrl.link_at_who(topic.content, function (err, content) {
if (err) {
return ep.emit(err);
}
topic.content = Util.xss(Showdown.parse(content));
ep.emit('[@user](/user/user)');
});
});
[@user](/user/user)没看见ep.on绑定,只有 ep.emit('[@user](/user/user)');这怎么理解,还有这个@有什么特殊意义吗
3 回复
不是create
了一组监听吗?
@user
也只是一个字符串而已呀!
create中就隐含了on
谢谢!