Event.On cannot use expiration logic? #598
Unanswered
GeekStocks
asked this question in
Q&A
Replies: 1 comment 4 replies
-
|
I'd created |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a need to respond to an event one (and only one) time. In other frameworks I am used to seeing
.Onand.Offlogic so that a listener can be removed after the first run (in my use case). I was surprised to see there is no.Offin Wails and I was going to propose a pull request to add it. That is, until I read the rather fancy expiration logic already written inManager.Start():So since you've already implemented a way to expire a listener after x runs, why does
.Onnot expose it here, but rather just hard codes a zero?Have I missed the proper way to
.Onan event x number of times? Thanks!Beta Was this translation helpful? Give feedback.
All reactions