Using the IObservable Approach, here is what I have written:
is it the good approach?
Unfortunately, when I use this with many cells it stops working...
Thanks
// to create a Timer
let createTimer (interval: float) =
let timer = new System.Timers.Timer(interval)
timer.AutoReset <- true
timer.Start()
timer.Elapsed
// helper function to use with excelObserve
let performOnEvent event (f: unit -> 'b) : IObservable<'b>=
event
|> Observable.map (fun _ -> f ())
// test function
let testAsync =
async {
let res = rnd.Next(0,1000)
return res
}
let funTest () =
Async.RunSynchronously testAsync
// example
[<ExcelFunction(Description = "Test")>]
let testObservable (str: string) =
FsAsync.FsAsyncUtil.excelObserve "test" [|str|]
(performOnEvent (createTimer 5000.) funTest)