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

What is Framer? Join the Community
Return to index
Florian Pnn
Posted May 20 - Read on Facebook

Hello guys,
I have a question regarding Classes. How can I succeed to add a property to the object Key without having to add it after creating a new layer? (see the picture below for a more explicit version)


Mårten Björk

Looks like there is a lot of property sanitization going in in the Layer constructor. I tried, but wasn't able to find an elegant way around it:

Mårten Björk

Adding stuff after calling super() is probably a major JS faux pas, but this did the trick for me:

Florian Pnn

I'll use this for now but maybe Koen Bok or anyone at Framer can suggest a more elegant way?

Krijn Rijshouwer

Ah, good one Florian Pnn. I made you a little example of how I would probably approach this. It allows you to assign any value you pass in the options to the class (aka this/@).

Example →

Jared Palmer

Just posted this in the Framer NYC group, good example of using classes that extend Layer and Framer.BaseClass:

Read the entire post on Facebook