How to get multiple events to use the same closure? #1794
Unanswered
veniamin-ilmer
asked this question in
Q&A
Replies: 1 comment
-
Isn’t this a question of calling |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have code which resizes an object when the window gets resized. This works fine
window_event_listener
and the eventev::resize
However, I find I need to run this code for when the page first loads as well.
There is a good handful of lines in this closure, and I'd want to avoid rewriting it. Essentially, I'd like to be able to do something like this:
However, this
move
closure gets consumed, so it cannot be used twice.I am not sure how this can be properly handled.
Beta Was this translation helpful? Give feedback.
All reactions