defend_if: Stops reactivity in shiny app if expression is TRUE

View source: R/utils_helpers.R

defend_ifR Documentation

Stops reactivity in shiny app if expression is TRUE

Description

Stops reactivity in shiny app if expression is TRUE

Usage

defend_if(.if, is_shiny = T, ...)

Arguments

.if

An expression that returns TRUE/FALSE (to be passed to an internal if statement)

is_shiny

TRUE/FALSE indicating whether using function inside a shiny app. Defaults to TRUE. Set to FALSE to practice using functions at the console.

...

Additional arguments passed to shinyShowNotification

Value

Nothing. Will either stop or allow shiny reactivity to continue

Examples

# This will stop reactivity and showNotification in UI
defend_if(TRUE, message = 'Oops!', type = 'error')

# This will allow reactivity to continue showing nothing in UI
defend_if(TRUE, message = 'Oops!', type = 'error')

# Practice at consolse with is_shiny = F

defend_if(TRUE, is_shiny = F)

brentscott93/lasertrapr documentation built on Aug. 29, 2024, 6:47 a.m.