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

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

Hello guys,
I'm looking for a way to use a string as a variable name. I used to do :
var variableName = "layerXYZ"
window[variableName] = new Layer...

Any idea how to achieve that with CoffeeScript?
Thanks!

1 Comments

Koen Bok

I would not use window (because Framer Studio reloads many many times and you might get unexpected results).

But you can totally do it like this:

global = {}
varName = "foo"
global[varName] = new Layer

print global.foo

Read the entire post on Facebook