Javascript 访问类的引用

Javascript 访问类的引用,javascript,pixi.js,Javascript,Pixi.js,鉴于: 在 取而代之的是PIXI.Sprite,因为我调用了spr.pointerup=func 有没有可能获得GameManager而不是PIXI.Sprite的参考资料 我不想使用全局变量 this.world.removeChildren() //GameManager.prototype.draw 在这里,你失去了上下文。您需要绑定上下文: this.text(this.drawgame); this.textthis.drawgame.bindthis@乔纳斯。谢谢,它正在工作,

鉴于:

取而代之的是PIXI.Sprite,因为我调用了spr.pointerup=func

有没有可能获得GameManager而不是PIXI.Sprite的参考资料

我不想使用全局变量

this.world.removeChildren() //GameManager.prototype.draw
在这里,你失去了上下文。您需要绑定上下文:

 this.text(this.drawgame);

this.textthis.drawgame.bindthis@乔纳斯。谢谢,它正在工作,请将此作为答案添加,以便我可以将其标记为正确
this.world.removeChildren() //GameManager.prototype.draw
 this.text(this.drawgame);
 this.text(this.drawgame.bind(this));