pixijs / spine

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

`state.removeListener` not as expected #550

Open xieyhn opened 3 months ago

xieyhn commented 3 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 3 months ago

"pixi-spine": "^4.0.4"

xieyhn commented 3 months ago

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