knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of asap is to help you render async
And the development version from GitHub with:
# install.packages("remotes") remotes::install_github("VincentGuyader/asap")
library(shiny) library(promises) library(future) library(asap) plan(multisession) ui <- fluidPage( column(6, plotOutput("one")), column(6, plotOutput("two")), column(6, plotOutput("three")), column(6, plotOutput("four")) ) server <- function(input, output, session) { plotiris <- reactiveVal() plotiris(NULL) update_asap(what = ~{ Sys.sleep(8); iris},to = plotiris) output$one <- renderPlot({ req(plotiris()) plot(plotiris()) }) output$two <- renderPlot({ plot(airquality) }) output$three <- renderPlot({ plot(mtcars) }) output$four <- renderPlot({ plot(cars) }) } shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.