Created
December 2, 2014 10:26
-
-
Save rozgo/2db80c908cbe085d82b3 to your computer and use it in GitHub Desktop.
Async.AwaitObservable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nowarn "40" | |
type Microsoft.FSharp.Control.Async with | |
static member AwaitObservable (evt : IObservable<'a>) = | |
Async.FromContinuations (fun (cont, econt, ccont) -> | |
let rec callback value = | |
sub.Dispose () | |
cont value | |
and sub : IDisposable = evt.Subscribe callback | |
()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment