Is there a way to attach event handler to a change of a canvas element? I need to fire a function whenever something draws anything on it.
canvas
You could use the mouseup event.
canvasElement.addEventListener('mouseup', e => { // Fire function! }); // or jQuery $('canvas').on('mouseup', function() { // Fire function! });
The mouseup docs above actually have a good canvas example