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

What is Framer? Join the Community
Return to index
Nikolay Berezovskiy
Posted Feb 03 - Read on Facebook

Hi, guys. Who knows how to call some part of a composite class from another module?

For example, I have to call an icon from a header and detect their events.

6 Comments

Sergey Voronov

exports.header.iconLeft=iconLeft=new Layer

Sergey Voronov

class Bla extends Layer
constructor: (options={}) ->
super options
childLayer=new Layer
this.child=childLayer
blabla=new Bla
print blabla.child

Anton Kartashov

I can rrrecommend you this video my rrrussian friend: https://youtu.be/W2WEItUzZwE?list=PLbmT-uqPoDTecsC5HxxJliMkgsCYyLJia

Jordan Robert Dobson

I would just assign it to a global variable. And share it that way.

Sergey Voronov

Its in the class, so each child of new element of the class should be accessible, that was the idea

Jordan Robert Dobson

Well if you include a global var across all modules it makes it much easier.

I typically have a global module that gets included / requires everywhere.

It starts out as $ = {}

And gradually

$.color =
orange: "#ff3300"
gray50: "#808080"

$.layer =
iconLeft: null

Then in another module

$.layer.iconLeft = new Layer ....

And then you're golden!

Read the entire post on Facebook