sdecima / javascript-detect-element-resize

A Cross-Browser, Event-based, Element Resize Detection
MIT License
880 stars 151 forks source link

Uncaught ReferenceError: resetTriggers is not defined #54

Open tannerlinsley opened 6 years ago

tannerlinsley commented 6 years ago

Using in create-react-app as a fresh install on the latest versions of everything, I'm getting this error. Not sure why it's happening, since the function is actually getting registered. Maybe it's not getting hoisted correctly?

The call is being made from here: https://github.com/sdecima/javascript-detect-element-resize/blob/master/detect-element-resize.js#L124

mrjamesriley commented 6 years ago

We came across the same issue. It would appear this is due to the fact that, as of ES2015 - a function within a conditional if block, is scoped to that block - and thus not available outside. Given that I'm using this in a require, the solution I've taken here is to use my own copy of the detect-element-resize file - with the if (!attachEvent) { conditional commented out.

wilkerlucio commented 6 years ago

Same issue here =/

kegi commented 4 years ago

@mrjamesriley's fix is working. Thanks