favico: Notification with favico.js

Description Usage Arguments Examples

View source: R/favico.R

Description

Display a badge in your favicon (displayed in the tab of a browser).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
favico(
  value,
  animation = c("pop", "slide", "fade", "popFade", "none"),
  position = c("up", "down", "left", "upleft"),
  type = c("circle", "rectangle"),
  bgColor = "#d00",
  textColor = "#fff",
  session = shiny::getDefaultReactiveDomain()
)

use_favico(img = NULL)

Arguments

value

Number to display on favicon.

animation

Animation to use : pop, slide, fade, popFade or none.

position

Position : ip, down, left or upleft.

type

Shape : circle or rectangle.

bgColor

Background color.

textColor

Text color.

session

Shiny session.

img

Path to an image (file should be located in www folder). Default is to used Shiny logo.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
if (interactive()) {
  
  library(shiny)
  
  ui <- fluidPage(
    use_favico(),
    actionButton("minus", "-1"),
    actionButton("plus", "+1")
  )
  
  server <- function(input, output, session) {
    
    value <- reactiveVal(0) 
    
    observeEvent(input$minus, {
      newValue <- value() - 1
      value(newValue)
    })
    
    observeEvent(input$plus, {
      newValue <- value() + 1
      value(newValue)
    })
    
    observeEvent(value(), {
      favico(value())
    })
  }
  
  shinyApp(ui, server)
  
}

dreamRs/shinypop documentation built on Oct. 18, 2021, 8:28 p.m.