Learn R Programming

shinyTimer (version 0.1.0)

updateShinyTimer: Update shinyTimer widget

Description

Update shinyTimer widget

Usage

updateShinyTimer(
  inputId,
  hours = NULL,
  minutes = NULL,
  seconds = NULL,
  type = NULL,
  label = NULL,
  background = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Value

No return value, called for side effects.

Arguments

inputId

The input ID corresponding to the UI element.

hours

The new starting time in hours for the countdown.

minutes

The new starting time in minutes for the countdown.

seconds

The new starting time in seconds for the countdown.

type

The new type of the countdown timer display ("simple", "mm:ss", "hh:mm:ss", "mm:ss.cs").

label

The new label to be displayed above the countdown timer.

background

The new shape of the timer's container ("none", "circle", "rectangle").

session

The session object from the shiny server function.

Examples

Run this code
if (interactive()) {
  library(shiny)
  shinyApp(
    ui = fluidPage(
      shinyTimer("timer", label = "Countdown Timer", seconds = 10, type = "mm:ss"),
      actionButton("update", "Update Timer")
    ),
    server = function(input, output, session) {
      observeEvent(input$update, {
        updateShinyTimer("timer", seconds = 20, type = "hh:mm:ss")
      })
    }
  )
}

Run the code above in your browser using DataLab