This is probably dumb question, but I'm new in Javascript and I really can't get it.
So I have a bunch of Chart.js graphs on my page and I wanted to add some custom behavior. I made such functions to generate different listeners for different graphs:
const listenerPointerUp = (params) =>
evt => {
//code
}
and set them up:
canvas.addEventListener('pointerup', listenerPointerUp(params));
but listeners just weren't working, although they were there in Chrome
until I tried:
canvas.onpointerup = listenerPointerUp(params)
Then it started working just fine.
I wonder what caused such behavior?
I hope I provided enough data to figure out what was my mistake. I suppose isn't caused by other context.