我有私人课程。在定义之后,我有以下代码。
rs.prototype = new EventTarget();
rs.prototype.constructor = rs;
EventTarget定义了一个fire方法。从rs方法中我试图调用self.fire(..) 调用因“未定义不是函数”而崩溃
当我将鼠标放在自己的Chrome上时,它会给出
__proto__: rs
打开我有
constructor: function rs(...
是
prototype: EventTarget
是
__proto__: EventTarget
是
fire: function (..
如何调用防火功能?有问题,因为这是私人课程吗?
答案 0 :(得分:0)
通过将它移到主机类之外来解决问题,使其不再是私有的。 这不是问题的解决方案。