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

What is Framer? Join the Community
Return to index
Ed Chao
Posted Jan 23 - Read on Facebook

Is there a simple way to destroy all sublayers? Something like foo.subLayers.destroy()?

I've also tried storing all my layers in an array and then emptying the array, but the layers are not destroyed :(

6 Comments

Jordan Robert Dobson

Destroyed as in removed from memory?

Jordan Robert Dobson

I have a post about this on http://FramerCo.de and how you can listen for those events.

Ed Chao

The trick here is that I'm creating layers by iterating through an array. By assigning each layer to an index in the array I am only pointing to them. So when I empty the array the layer lives on!

Ed Chao

ANSWER -->

Koen Bok

Also protip: _.invoke(layer.subLayers, "destroy")

Read the entire post on Facebook