小游戏new出来的对象如何销毁?

发布于 6 年前作者 gang6112211 次浏览最后编辑 6 年前来自 ask

class a {
constructor() {
canvas.addEventListener(‘touchstart’, ((e) => {
e.preventDefault()

  console.log(1);
  
}).bind(this))

}

}
wx.onShow(function(){
new a;
})

运行后,发现触摸仍被侦听,按道理来讲,new之后无变量保存对象,对象就自动销毁了.
如何破?

0 回复
暂无回复