Created
October 26, 2018 18:30
-
-
Save dkulp2/f1a773fcf29cfccd788bc7c8b7b35189 to your computer and use it in GitHub Desktop.
Slow shinyalert with large memory and callback
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
| library(shiny) | |
| library(shinyalert) | |
| options(digits.secs=6) | |
| ui <- fluidPage( | |
| useShinyalert(), | |
| actionButton("foo","Modal With Callback"), | |
| actionButton("bar","Modal Without Callback"), | |
| sliderInput("sz", "Matrix Dimension:", 10, 20000, 1000), | |
| h3("Matrix size:"), | |
| textOutput("matrix.sz"), | |
| h3("Modal response time:"), textOutput("modal.time") | |
| ) | |
| server <- function(input, output) { | |
| modal.time <- reactiveVal() | |
| ok <- function(x) message(x) | |
| observeEvent(input$foo, { | |
| t1 <- Sys.time() | |
| shinyalert("With Callback", callbackR=ok) | |
| modal.time(Sys.time()-t1) | |
| }) | |
| observeEvent(input$bar, { | |
| t1 <- Sys.time() | |
| shinyalert("Without Callback") | |
| modal.time(Sys.time()-t1) | |
| }) | |
| output$matrix.sz <- renderPrint({ print(object.size(z()), units="auto") }) | |
| output$modal.time <- renderPrint({ modal.time() }) | |
| z <- reactive({ | |
| matrix(nrow=input$sz, ncol=input$sz) | |
| }) | |
| } | |
| # Run the application | |
| shinyApp(ui = ui, server = server) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regarding shinyalert issue #19.