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]
The problem code as a screen shot:
Marc, Jordan, you guys have been pretty helpful here recently. Any chance I could get a little assist on this?
Is there any particular reason why insist on using throttle instead of using more low-level "cooldown"-patterns?
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".
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_____else__________return
EDIT: nope, that doesn't work
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.
http://share.framerjs.com/qny8ohtphlpa/EDIT: added equivalent version using throttle
Well, maybe this approach does work after all?! :)
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 :/
Thanks for the help Marc. I'll check this out a little later today.
I've not used throttle myself much. Ill take a look today if I have time.
I'm still looking for help on this, not sure who to ping to get more info.