question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

this.handlers is undefined

See original GitHub issue

Wavesurfer.js version(s):

4.1.0

Code needed to reproduce the issue:

Region plugin doesn’t load, check example page:

https://wavesurfer-js.org/plugins/regions.html

When calling this.regions.add(options). Line 199 of regions/index.js registers this event:

        region.on('remove', () => {
            delete this.list[region.id];
        });

Results in TypeError: can't access property "remove", this.handlers is undefined

Last change to observer: https://github.com/katspaugh/wavesurfer.js/commit/590d9ccc96f6c69090849f2e5cfb4587da647ee5 Looks like removing the lazy creation of handlers object broke the regions plugin.

Found this comment in observer.js: * plugins borrow part of this class without calling the constructor Can we do something about that without breaking existing plugins? Not calling the constructor doesn’t sound very good.

Worst case scenario we revert to what we were doing before.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
thijstriemstracommented, Sep 25, 2020

4.1.1 was released and fixes this issue.

0reactions
thijstriemstracommented, Sep 24, 2020

Or maybe we should revert 590d9cc. It was just code cleanup changes.

@sundayz please do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: handler is undefined - javascript - Stack Overflow
While handler is declared, it will remain undefined because at that point in time, based on how you assign initial values to your...
Read more >
Deal with Undefined 'this' in React Event Handlers Correctly
When teaching React to developers, one thing that comes up often is dealing with a common error. In this post, learn how to...
Read more >
How to Fix ReferenceError: Event is Not Defined in JavaScript
JavaScript's ReferenceError: Event is Not Defined occurs if the event parameter is not declared correctly when using an event handler.
Read more >
Adapters • Waypoints - I Make Web Things
undefined . ... This binds an event listener to the element. Only a subset of jQuery's on needs to be implemented. Multiple space...
Read more >
undefined - JavaScript - MDN Web Docs - Mozilla
In all non-legacy browsers, undefined is a non-configurable, non-writable property. Even when this is not the case, avoid overriding it. A ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found