Better reactivePoll example. Closes #1678

This commit is contained in:
Winston Chang
2017-04-25 10:48:29 -05:00
parent af8d099b9f
commit deb56539fb
2 changed files with 30 additions and 4 deletions

View File

@@ -57,9 +57,22 @@ will be executed in a reactive context; therefore, they may read reactive
values and reactive expressions.
}
\examples{
# Assume the existence of readTimestamp and readValue functions
function(input, output, session) {
data <- reactivePoll(1000, session, readTimestamp, readValue)
data <- reactivePoll(1000, session,
# This function returns the time that log_file was last modified
checkFunc = function() {
if (file.exists(log_file))
file.info(log_file)$mtime[1]
else
""
},
# This function returns the content of log_file
valueFunc = function() {
read.csv(log_file)
}
)
output$dataTable <- renderTable({
data()
})