messageFuncs: Show a message

Description Usage Arguments Note See Also Examples

Description

alert (and its alias info) shows a message to the user as a simple popup.

logjs writes a message to the JavaScript console. logjs is mainly used for debugging purposes as a way to non-intrusively print messages, but it is also visible to the user if they choose to inspect the console. You can also use the showLog function to print the JavaScript message directly to the R console.

Usage

1
2
3
4
5

Arguments

text

The message to show. Can be either simple text or an R object.

Note

shinyjs must be initialized with a call to useShinyjs() in the app's ui.

See Also

useShinyjs, runExample, showLog

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (interactive()) {
  library(shiny)
  shinyApp(
    ui = fluidPage(
      useShinyjs(),  # Set up shinyjs
      actionButton("btn", "Click me")
    ),
    server = function(input, output) {
      observeEvent(input$btn, {
        # Change the following line for more examples
        alert(paste0("The date is ", date()))
      })
    }
  )
}
## Not run: 
  # The shinyjs function call in the above app can be replaced by
  # any of the following examples to produce similar Shiny apps
  alert("Hello!")
  alert(text = R.Version())
  logjs(R.Version())

## End(Not run)

YTLogos/shinyjs documentation built on May 21, 2019, 1:41 a.m.