WaitFor blocks the execution until the event is received
(event EventType)
| 81 | |
| 82 | // WaitFor blocks the execution until the event is received |
| 83 | func (b *EventBox) WaitFor(event EventType) { |
| 84 | looping := true |
| 85 | for looping { |
| 86 | b.Wait(func(events *Events) { |
| 87 | for evt := range *events { |
| 88 | switch evt { |
| 89 | case event: |
| 90 | looping = false |
| 91 | return |
| 92 | } |
| 93 | } |
| 94 | }) |
| 95 | } |
| 96 | } |