Why can't I subsribe to resize event?


#1

I have a dom element named domNode. I tried to subscribe it to resize event using the following code

@domNode.addEventListener 'resize', @callback

In Developer tools, I can see domNode element to be subscribed to resize event, but callback is never called.

is it that the resize event is triggered only in special situations?


#2

I found the solution
Instead of adding event listener to domNode
I used
window.onresize = @callback

it worked