Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
node.js 是否有等效于 jquery 的 event.type 方法,即以字符串形式给出事件名称的东西?
我已经尝试过 event.type 但到目前为止它还没有为我工作......
您可以添加一个小包装函数,为您提供名称
EventEmitter.prototype.addNamedListener = function(event, handler){ return this.addHandler(function(x){ handler({ event: event, data: x }); }); };