pixijs / spine

Pixi.js plugin that enables Spine support.
Other
570 stars 217 forks source link

`state.removeListener` not as expected #550

Open xieyhn opened 6 months ago

xieyhn commented 6 months ago

Example below, when I remove the callback when the first callback is called, then the second callback never gets called.

const animation = new Spine(/* ... */)

const listener = {
  complete: () => {
    animation.state.removeListener(listener)
  },
}

animation.state.addListener(listener)
animation.state.addListener({
  complete: () => {
    // Never called
  },
})
xieyhn commented 6 months ago

"pixi-spine": "^4.0.4"

xieyhn commented 6 months ago

Maybe the problem is in the for i loop that calls the callback