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

What is Framer? Join the Community
Return to index
Mehdi Djabri
Posted Feb 21 - Read on Facebook

Hey guys, most of the time I find myself listening to events only once, what do you think about adding a "once" method in events? Instead of having to write something like:

onSomeEvent = ->
someLayer.off Events.SomeEvent
# do something

someLayer.on Events.SomeEvent, onSomeEvent

3 Comments

Benjamin Den Boer

Hey Mehdi Djabri, you could use _.once(func) to create a version of the function that can only be called one time.

Koen Bok

This works too: layer.once -> ...

Mehdi Djabri

Thanks guys!

Read the entire post on Facebook