R/run_app.R

Defines functions run_app

Documented in run_app

#' @title Run the GuaraDash application
#'
#' @description A function to run GuaraDash.
#'
#' @usage run_app(...)
#' 
#' @param ... Golem options.
#' 
#' @author Angelo Rosa Bastos
#' 
#' @export
#' @importFrom shiny runApp
#' @importFrom golem with_golem_options
#' @importFrom rstudioapi hasFun
run_app <- function(...) {
  # Configurações necessárias pra rodar direto no Chrome:
  if (
    # Verificando se o pacote rstudioapi está disponível:
    requireNamespace("rstudioapi", quietly = TRUE) &&
    # Verificando se o RStudio está rodando:
    hasFun("viewer")
  ) {
    # Configurando o shiny a renderizar o aplicativo numa janela externa:
    options(shiny.launch.browser = .rs.invokeShinyWindowExternal)
    # Definindo caminho ao Google Chrome:
    options(browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe")
  }  
  
  # Rodando o aplicativo com opções dadas por golem_opts:
  with_golem_options(
    app = runApp(appDir = list(ui = app_ui, server = app_server)), 
    golem_opts = list(...)
  )
}
guarastats/GuaraDash documentation built on March 31, 2020, 3:37 p.m.