Registration icon indicating copy to clipboard operation
Registration copied to clipboard

Specify a custom message for a running task

Open altso opened this issue 4 years ago • 0 comments

Could you please advise on the right way to specify a value to be displayed when task is in Running state? Given the example below, I'm trying to show something like "#N/A Calculating..." for the first 5 seconds until value is returned. The default behavior is to show it as "#N/A".

[ExcelAsyncFunction]
public static async Task<object> GetValueIn5Seconds()
{
    await Task.Delay(5000);
    return 42;
}

It seems like it's easily achievable with IObservable, but I'd prefer using Task if possible.

I was considering intercepting the registration process and implicitly converting Task to IObservable with a first emitted value "#N/A Calculating..." Any thoughts on that approach? Is there a better way to do it?

altso avatar Jul 01 '20 15:07 altso