Cannot read property 'addEventListener' of undefined when calling enableDragSelection
See original GitHub issueHello,
I am using wavesurfer within a react app, and I came across a strange issue. I’m using the Regions plugin and I need to do enableDragSelection. So once the wavesurfer is ready and it fires the ready
event, I call wavesurfer.enableDragSelection({});
. This works just fine when I am running the app locally, but as soon as I make a deploy on Heroku, I get this error instead.
Uncaught TypeError: Cannot read property 'addEventListener' of undefined
at o.value (regions.js:742)
at o.enableDragSelection (regions.js:607)
Any help really appreciated! 😃
Wavesurfer.js version(s): 2.1.1
Browser version(s): Chrome v70
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
javascript - Cannot read property 'addEventListener' of null
I think the easiest approach would be to just check that el is not null before adding an event listener: var el =...
Read more >Uncaught TypeError cannot read property ...
In JavaScript, a very common error is the Uncaught TypeError Cannot read property 'addeventlistener' of null. This error occurs when JavaScript is not...
Read more >[SOLVED] Cannot Read Property 'addEventListener' of Null ...
The “cannot read property 'addEventListener' of null” error occurs in JavaScript when you try to call the addEventListener() method on an ...
Read more >Explaining and Solving "Cannot read property ... - YouTube
Your browser can't play this video. ... need to save and refresh Cannot read property addEventListener of undefined - Variable declared but ...
Read more >How to fix "TypeError: Cannot read properties of ... - YouTube
JS Casts 12 - How to fix " TypeError: Cannot read properties of null ( reading addEventListener )" in JavaScript.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for all your help guys, I resolved it by checking the
isReady
value inwavesurfer.regions.wavesurfer
like so:I might look into adding that event @thijstriemstra when I get some free time this weekend 👍
I am using Wavesurfer in react app . It works . I save the regions in server . I want to add the saved region when the annotate load …