countdown_update {countdown}R Documentation

Update a Countdown Timer in a Shiny App

Description

Updates the settings of a countdown timer dynamically in a Shiny app via server logic. See countdown_shiny_example() for an example app demonstrating the usage of countdown_update().

Usage

countdown_update(
  id,
  ...,
  minutes = NULL,
  seconds = NULL,
  warn_when = NULL,
  update_every = NULL,
  blink_colon = NULL,
  play_sound = NULL,
  session = NULL
)

Arguments

id

A character vector with one or more id values for timers created with countdown() or countdown_fullscreen(). Be sure to set the id value when creating the timer.

...

Ignored, but included for future compatibility.

minutes

The number of minutes for which the timer should run. This value is added to seconds.

seconds

The number of seconds for which the timer should run. This value is added to minutes.

warn_when

Change the countdown to "warning" state when warn_when seconds remain. This is achieved by adding the warning class to the timer when warn_when seconds or less remain. Only applied when greater than 0.

update_every

Update interval for the timer, in seconds. When this argument is greater than 1, the timer run but the display will only update, once every update_every seconds. The timer will switch to normal second-by-second updating for the last two update_every periods.

blink_colon

Adds an animation to the blink the colon of the digital timer at each second. Because the blink animation is handled via CSS and not by the JavaScript process that decrements the timer, so the animation may fall out of sync with the timer. For this reason, the blink animation is only shown, by default, when update_every is greater than 1, i.e. when the countdown time is updated periodically rather than each second.

play_sound

Play a sound at the end of the timer? If TRUE, plays the "stage complete" sound courtesy of beepr. Alternatively, play_sound can be a relative or absolute URL to a sound file, such as an mp3, wav, ogg, or other audio file type.

session

The reactive session object for the current Shiny session. In general, only required for expert or unusual use cases.

Value

Invisibly returns the options sent to update the countdown timer(s).

See Also

Other Shiny functions: countdown_action(), countdown_app(), countdown_shiny_example()


[Package countdown version 0.4.0 Index]