R/mod_image.R

Defines functions mod_image_ui mod_image_server

Documented in mod_image_server mod_image_ui

# Module UI

#' @title   mod_image_ui and mod_image_server
#' @description  A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_image
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_image_ui <- function(id) {
  ns <- NS(id)
  with_loading_message(plotOutput(ns("image"), height = "100vh"),
                       "loading...")
}

# Module Server

#' @rdname mod_image
#' @export
#' @keywords internal
mod_image_server <- function(input, output, session, image) {
  output$image <- renderPlot({
    plot(as.raster(image()))
  })
}
igjit/lroom documentation built on Nov. 4, 2019, 1:55 p.m.