CNode

小菜鸟关于ON的疑问。

Gggaaooppeenngg发布于13 年前最后回复13 年前4 回复4478 浏览0 收藏

像createServer(function(req,res)) req,res这些对象怎么传进去的? 还有client.on('data',function(data))里的DATA是怎么传进去的,on是表示对事件监听的回调函数么?

查看回复

回复 (4)

L
leapon#1·13 年前

这些都是回调函数。由系统调用,参数也是系统传进去的。

J
jiyinyiyong#3·13 年前

Node 好像一大堆都从 events 继承下来的, 和 Backbone 好像, http://nodejs.org/api/events.html events 模块的 JS 实现, 也有源码可看 https://github.com/joyent/node/blob/master/lib/events.js#L89 https://github.com/Wolfy87/EventEmitter/blob/master/EventEmitter.js#L300

参与回复
登录后即可参与回复。登录