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

What is Framer? Join the Community
Return to index
Taylor Wright
Posted Dec 17 - Read on Facebook

I've got a lingering question about how the scope of throttle / debounce work inside of a module. I made a project and screen capture to more concisely illustrate the issue. You can also find the file here:
http://share.framerjs.com/b3tv7dggtrcn/

6 Comments

Taylor Wright

This isn't holding my projects up but it's not helping performance either… and I'm stubborn and would like to understand how to get this to work.

Taylor Wright

Koen Bok, Noah Levin, could you guys help me out with this one?

Taylor Wright

Charlie Deets, do you or the gang have an idea of how to set this up?

Koen Bok

This is pretty advanced. I _think_ this is a practical limitation of CS, where you cannot reference an instance method where you declare instance methods. Instead, you can add it after the class.

You could also make and set the method in the constructor on the created object, but that will create a new function for each object instead re-using the one on prototype, so I wouldn't do that.

http://share.framerjs.com/o0kmz2vkdsa7/

Taylor Wright

Koen this info is really helpful, thank you. I'm using this for a grid layout module, trying to limit the number of layout calls per frame. In my instance I'll only have one instance of the module, so it's not too bad but I'll try to consider how to make it more consistent.

Read the entire post on Facebook