2017-02-19 5 views
1

こんにちは私はいくつかの計算後にサーバー側から "false"入力更新を送信したいと思います。言い換えれば、出力更新伝播の順序を制御したいと思います。光沢のある更新伝播順序を制御する方法

たとえば、スクリプトで、私は第二observeEventでSys.sleep後の出力$テキスト更新する必要があります下に:私のコメントでmentiontedたよう

library(shiny) 

ui <- fluidPage(

    titlePanel("PLOP"), 

    sidebarLayout(
     sidebarPanel(
     selectInput("variable", "Variable:", 
        c("Cylinders" = "cyl", 
         "Transmission" = "am", 
         "Gears" = "gear")), 
     actionButton("press","press") 
    ), 

     mainPanel(
     textOutput("text") 
    ) 
    ) 
) 

server <- function(input, output) { 

    output$text <- renderText({ 
    input$press 
    message("rendertext at ",Sys.time()) 
    paste(input$variable,Sys.time())}) 

    observeEvent(input$variable, 
       message("variable is edited at ",Sys.time()) 
       ) 
    observeEvent(input$press,{ 
       message("button is presed at ",Sys.time()) 
       # lot of stuff 
       Sys.sleep(2) 
       message("end calculation at ",Sys.time()) 
       # AND NOW I would like to send a "false" input$variable update 
       # I dont want to change input$variable, but I need to rerun everything which use input$variable 
       # (....) for example : changing output$text but AFTER the Sys.sleep call 


}) 




} 

# Run the application 
shinyApp(ui = ui, server = server) 

おかげでたくさん

答えて

1

を:?oberserveEventでパラメータpriorityを設定することができます。優先順位の高い番号の関数が最初に評価されます。

関連する問題