Skip to content

Commit

Permalink
add wrapper for wait_for_value for output value. (#1172)
Browse files Browse the repository at this point in the history
This PR introduces a wrapper for the wait_for_value method, specifically
designed for output values.

---------

Signed-off-by: kartikeya kirar <kirar.kartikeya1@gmail.com>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Mar 27, 2024
1 parent e03bf26 commit 72a81da
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
25 changes: 25 additions & 0 deletions R/TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,31 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
#' @return Nothing. Opens the underlying teal app in the browser.
open_url = function() {
browseURL(self$get_url())
},
#' @description
#' Waits until a specified input, output, or export value.
#' This function serves as a wrapper around the `wait_for_value` method,
#' providing a more flexible interface for waiting on different types of values within the active module namespace.
#' @param input,output,export A name of an input, output, or export value.
#' Only one of these parameters may be used.
#' @param ... Must be empty. Allows for parameter expansion.
#' Parameter with additional value to passed in `wait_for_value`.
wait_for_active_module_value = function(input = rlang::missing_arg(),
output = rlang::missing_arg(),
export = rlang::missing_arg(),
...) {
ns <- shiny::NS(self$active_module_ns())

if (!rlang::is_missing(input) && checkmate::test_string(input, min.chars = 1)) input <- ns(input)
if (!rlang::is_missing(output) && checkmate::test_string(output, min.chars = 1)) output <- ns(output)
if (!rlang::is_missing(export) && checkmate::test_string(export, min.chars = 1)) export <- ns(export)

self$wait_for_value(
input = input,
output = output,
export = export,
...
)
}
),
# private members ----
Expand Down
29 changes: 29 additions & 0 deletions man/TealAppDriver.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 72a81da

Please sign in to comment.