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 08 - Read on Facebook

Progress on my current prototype. Still trying to figure out how to manage throttle in a Module. Please check the "draw" and "updateContentSize" functions towards the bottom of the GridModule.

Ideally I'd like to have "draw" throttle a call to "_draw" but I haven't been able to figure out the scope (same for updateContentSize).

[problem script added to comments as image]


Taylor Wright

The problem code as a screen shot:

Taylor Wright

Marc, Jordan, you guys have been pretty helpful here recently. Any chance I could get a little assist on this?

Marc Krenn

Is there any particular reason why insist on using throttle instead of using more low-level "cooldown"-patterns?

Taylor Wright

If it sounds like I'm insistent it's just my own ignorance. Throttle and Debounce are the only functions I've heard of to prevent functions from being spammed and I figured I'd try to understand them before rolling my own solution. Can you provide a reference to the patterns you're talking about? nothing came up in the group when I searched for "cooldown".

Marc Krenn

Nonono, I'm sorry, maybe "insisting" came across rather harshly, which wasn't my intention. Again, my fault :)

For example you could use a boolean in combination with Utils.delay to prevent the spamming. Something like:

draw = ->
_____if cooldown is false
__________#put your stuff here
__________cooldown = true
__________Utils.delay 0.5, ->
_______________cooldown = false

EDIT: nope, that doesn't work

Taylor Wright

I'm happy to try other approaches, though I'll still have the burning desire to know how the throttle and debounce scope works. A lot of my past experience is with Flash, where I had a root to work from, but I'm not sure what the equivalent is in Framer so it's been tricky navigating my way around the scope.

Marc Krenn
EDIT: added equivalent version using throttle

Well, maybe this approach does work after all?! :)

Marc Krenn

Unfortunately, it seems like I can't figure it out myself. I'm sorry.

Hopefully Jordan or someone from the framer team will help you out on this one :/

Taylor Wright

Thanks for the help Marc. I'll check this out a little later today.

Jordan Robert Dobson

I've not used throttle myself much. Ill take a look today if I have time.

Taylor Wright

I'm still looking for help on this, not sure who to ping to get more info.

Read the entire post on Facebook