Add 'event' parameter to 'handled' lambda in 'ViewEvent' 'peek()'
See original GitHub issueThis is not an important change, but It’s an enhancement. Currently, the function peek, It’s the following:
viewModel.observeState(this) {
it.event?.peek {
when (it.event) {
is CatViewEvent.Meow -> {
// show Meow! dialog
true
}
}
}
}
But into the peek function, I need use again the “it.event”. It’s can resolve changing the parameter in the peek function:
fun peek(handled: ViewEvent.() -> Boolean) {
if (!alreadyHandled) alreadyHandled = this.handled()
}
So, the new peek method would be used:
viewModel.observeState(this) {
it.event?.peek {
when (this) {
is CatViewEvent.Meow -> {
// show Meow! dialog
true
}
}
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Lambda event source mappings - AWS Documentation
Configure a Lambda event source mapping to invoke your function from queue and stream event sources, such as Amazon SQS, Kinesis, and DynamoDB....
Read more >Chapter 2: What is the event & context?
When you create a lambda function from the console, it is automatically populated ... Handler functions must always take two arguments, event and...
Read more >Integrating Lambda Expressions and Events
Using lambda expressions is a more compact way of wiring up events in both C# and Visual Basic. It also provides a way...
Read more >Understanding Event Parameters in Google Analytics 4 (GA4)
Event parameters in Google Analytics 4 (GA4) are the additional information about an event that is sent along with the event.
Read more >Working with Events in JavaScript - Salesforce Developers
Throwing and Handling Errors ... Dynamically Adding Event Handlers To a Component ... event.getParams() returns an object containing all event parameters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Normally executing an event multiple times should be accomplished by setting an updated
ViewState
with a new event.I totally forgot about
internal
. That should accomplish pretty much exactly what I’m aiming for. I’ll probably keep this for a later update though since it’s a really minor thing.Thanks for your input. 🙂
Hi @etiennelenhart , I apologize for the delay. Thanks for the support. I was thinking about it too and I think that the public variable would help to execute events again. Similarly, the visibility “internal” would help a lot. Thanks again for the support, I will be testing as soon as possible.