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

What is Framer? Join the Community
Return to index
Oliva Rawlings
Posted Feb 06 - Read on Facebook

hey !! super new to framer atm & wondering if it's possible to do more object oriented code with coffeescript ?? Can't seem to figure out a way of defining classes in it & I'm sick of typing the same parameters into each pageComponent I make : (

6 Comments

Oliva Rawlings

thank you both so much !!!! lifesavers : )

Jonas Treub

FramerCasts just covered custom components in their tutorial series. https://www.framercasts.com/videos/18

Oliva Rawlings

ok so I've been able to create & call objects but for some reason they don't take on the attributes defined in the constructor ???? like, as you can see below, the 2 instances of header are there, & they are functionally layers, but their x, y , w & h values remain the defaults ??? what am I doing wrong : s

Jonas Treub

Hi Oliva! Your indentation is off and you'll need to call super in the constructor. To keep the class flexible you'll want to check when certain options are already specified before overriding. The ?= assignment is perfect for that. It only sets the value if it does not exist. Here is an example: https://framer.cloud/RzHuV

Read the entire post on Facebook