In F# I know how to wait asynchronously for one event using Async.AwaitEvent:
let test = async {
let! move = Async.AwaitEvent(form.MouseMove)
...handle move... }
Suppose I want to wait for either the MouseMove or the KeyDown event. I’d like to have something like this:
let! moveOrKeyDown = Async.AwaitEvent(form.MouseMove, form.KeyDown)
This function doesn’t exist but is there another way to do this?
EDIT: another version that preserves original types
EDIT 2: according to comments of Tomas Petricek
AwaitObservable primitive can be taken from here (‘Reactive demos in Silverlight’ by Tomas Petricek).