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

What is Framer? Join the Community
Return to index
James Morris
Posted Jun 13 - Read on Facebook

Hey guys. I want to better organise my projects. I know and used custom events before in other projects but was curious if Framer offers a tried and tested or more official way to actually create your own events, to listen to them and trigger them? Want to start using global events more in my prototypes... Any insights or tips? Thanks!

5 Comments

Mike Feldstein

you should be able to use layer.on "MyEvent" and layer.emit "MyEvent"

James Morris

That's great Mike, wasn't aware of "emit". Any way to do this on a more global level? Something that any layer could listen to and respond to?

Mike Feldstein

you could create an invisible layer called eventCenter with width:0,height:0 and everybody could just listen to and emit on that guy

Koen Bok

You can skip making a layer and use Framer.EventEmitter directly: http://share.framerjs.com/1fgkua8l4rv8/

It's based on https://github.com/primus/eventemitter3

James Morris

That's the one Koen! ...I know about events in various frameworks/libraries but wasn't sure how to apply it to Framer specifically. Thanks!

Read the entire post on Facebook