Anyone know why I keep getting this error?"TypeError: Attempting to change the setter of an unconfigurable property."
I'm trying to define getters/setters dynamically. This code actually works on refresh (command + R); the error appears, however, as soon as I attempt editing any of the code. It's driving me bonkers.
Here's the code:https://framer.cloud/ry8yJWsNl
Also, I realize this approach is entirely unnecessary, but I'd love to use this pattern in other places... 🤓
So basically it works on save but not on refresh right?
So typically you can't change these after they are defined. So do a try and catch.
Basically Framer only reloads the instantiation of objects I believe but doesn't replace a class. Or something to that affect... Eelco or Koen could explain better probably.
I have an example I can get you if this isn't clear. I did it for a triangle class I worked on.
Ohhh interesting. Ok i think I understand. I'm still trippin a little tho. Doesn't the BaseClass.define method use Object.defineProperty on the prototype? How come that doesn't work, but manipulating the object prototype directly works fine? Is it because BaseClass.define is a class method, rather than an instance method?
Here you go. Hope this helps
I think lines 11 and 20 should be changed to have _setScaledBackground with an underscore. Otherwise lines 11 and 18 conflict with two different definitions of setScaledBackground.
I get your pattern, I'm just wondering if CoffeeScript will have a collision between the setScaledBackground function and the scaleBackground setter, name-wise.