Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.defineProperty called multiple times in case of WebComponents using webaudiocontrols + dragged and dropped #43

Open
micbuffa opened this issue Mar 29, 2021 · 0 comments

Comments

@micbuffa
Copy link
Contributor

I'm using webaudiocontrols in WebAudio plugins that are WebComponents. I wrote a host in which these plugins can be dragged and dropped into the DOM. Each time a connectedCallback is called, and webaudiocontrols breaks because of the multiple Object.defineProperties that scream because the properties have already be defined.

An easy fix is to add a test before defining the properties

if (!this.hasOwnProperty("src")) Object.defineProperty(this, "src", { get: () => { return this._src }, set: (v) => { this._src = v; this.setupImage() } });

I made this fix in a local version of webaudiocontrols : https://github.com/53js/webaudiomodule/blob/fix/dragndrop/packages/pingpongdelay/src/Gui/utils/webaudio-controls.js check all lines with an occurence of "Object.defineProperty" !

I can make a PR but I'm afraid to be a bit late compared to your last updates... I will try to catch up and make a proper PR. But if you could add a test to check if a property is defined before defining it with ObjectProperty, this will enable WebComponents using webaudiocontrols to be dragged and dropped in the DOM without breaking.

Thanks in advance.

@micbuffa micbuffa mentioned this issue Jan 26, 2022
abulka added a commit to abulka/webaudio-controls that referenced this issue Jan 26, 2022
g200kg added a commit that referenced this issue Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant