0

我正在尝试阅读EventEmitter的来源。我想跳入aliasClosure()函数中定义的闭包alias(name)

function alias(name) {
    return function aliasClosure() {
        return this[name].apply(this, arguments);
    };
}

还:

proto.on = alias('addListener');

我写小脚本

var ee = new EventEmitter();
function l() {
  console.log('Test');
}

ee.on('foo', l);

ee.emitEvent('foo');

并在 FireBug 中的 F11 之后在线设置断点ee.on('foo', l);我正在等待跳转return this[name].apply(this, arguments);但我在控制台中收到错误消息:

恢复调试器:调试循环期间出错:TypeError: firstViewRangeElement is null

如果我在行return this[name].apply(this, arguments); 调试器上设置断点跳过(不要停止)这个断点。我做错了什么?

4

0 回答 0