Hello, I am using promises
library in my shiny app. I want to display 'loading' while promise is pending. In order to do that, I need to know if a promise is pending or fulfilled. If I would use future
library, I could access the state of the future by accessing state value of the object like this:
library(future)
plan(multisession)
g <- future(expr = {Sys.sleep(30);"done!"})
g$state
[1] "running"
So how can i do the same thing for a promise object?
Here is an example promise object:
library(promises)
library(future)
plan(multisession)
g <- future_promise(expr = {Sys.sleep(30);"done!"})
If i call g
on console I get this result
<Promise [pending]>