This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Isaac Weinhausen
Posted Dec 27 - Read on Facebook

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

8 Comments

Isaac Weinhausen

Also, I realize this approach is entirely unnecessary, but I'd love to use this pattern in other places... 🤓

Jordan Robert Dobson

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.

Jordan Robert Dobson

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.

Jordan Robert Dobson

I have an example I can get you if this isn't clear. I did it for a triangle class I worked on.

Isaac Weinhausen

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?

Jordan Robert Dobson
Mark Collette

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.

Mark Collette

I get your pattern, I'm just wondering if CoffeeScript will have a collision between the setScaledBackground function and the scaleBackground setter, name-wise.

Read the entire post on Facebook