0
我有一個閃亮的應用程序,它使用傳單庫。 我現在需要使用get.Bounds()
函數來獲取一些座標。很容易(js file
):奇怪的行爲傳單和閃亮
var myBounds = map.getBounds();
console.log(myBounds);
然後我需要發送的座標閃亮作進一步處理(也是我js file
:
Shiny.onInputChange("bounds", myBounds);
要查看是否奏效,它在server.R
這並:
observe({
print(input$bounds)
})
然而,當我運行在R中的應用控制檯出現NULL
。通過我的.js file
中的console.log
座標打印在Firefox控制檯上。
但是,它現在工作。當我運行Shiny App十次時,它有時會運行三次,有時甚至四次,有時甚至從未運行。我得到的座標,他們打印到R控制檯。我也嘗試過reactive
,但那不可能。這裏同樣的行爲。
#get extensions of map
myBoundsR <- reactive({
input$bounds
})
#print extensions
observe(print(myBoundsR()))
爲什麼?爲什麼不相關的行爲?!爲什麼行Shiny.onInputChange("bounds", myBounds);
將座標發送到server.R
?
現在效果更好。每隔一段時間我都會得到一個NULL值。但是,這種情況非常罕見。 – Stophface