Mapping Messages in the update
function
#1899
Unanswered
andretietz
asked this question in
Q&A
Replies: 1 comment
-
I think this is similar to the discussion at #1172. You basically have all the information you need to make your decision when the first message arrives, so you should be able to structure your code in a way that allows you to run all the required logic at that point without resorting to manually dispatching messages nor duplicating code. |
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
-
When I implement the
update
function ofApplication
sometimes I would like to see a mapping of my message.I know this seems odd in the first place, since I could directly send the message I want a command to follow on, but have a look on the following example:
Whenever my tab gets selected, I want to reinitialize it, this is why I am calling
on_select()
and afterwards there's nothing to be done, but to forward the message into the tab. I am using e.g.in order to do this "mapping".
Now one might say "well why don't you "map" this directly in the callback of tabselection instead of the
update()
method itself?"update()
andview()
(where I set the callback) are running in the same Thread/Coroutine. If they do, this is likely subject of change. I want to keep logic out of theview()
method.on_select
method within a callback requires Boxing, which seems unnessessary for this case.May be I am already able to do this kind of mapping, without creating an empty async function, if so, I don't know how.
Beta Was this translation helpful? Give feedback.
All reactions