代码之家  ›  专栏  ›  技术社区  ›  IVIM

有没有办法从程序上知道shiny是否在运行?

  •  1
  • IVIM  · 技术社区  · 4 年前

    input 从闪亮的。但是为了测试这些函数,我需要在没有Shiny的情况下运行它们。所以我想做这样的事。

    ---
    title: "My report that prints `input` variable in both reactive and static format" 
    # runtime: shiny # I want to be able programmatically to see when Shiny is running and when NOT
    ---
    
    ```{r}
    library(shiny)
    input0 <- list()
    input0$typedDate <-  "6/08/1935"
    
    if (!is.shinyRunning()) {
      print("Shiny is Not Running")
      input <- input0
    } else {
      textInput("typedDate", "Enter Date:", "6 jul 1935")
    }
    
    renderPrint(input$typedDate)
    

    注意,我试过用 if (interactive())

    1 回复  |  直到 4 年前
        1
  •  1
  •   Stéphane Laurent    4 年前

    这是 isRunning “闪亮”中的函数。

    此函数用于测试Shiny应用程序当前是否正在运行。