Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #956 improve get_golem_options doc #957

Merged
merged 3 commits into from
Dec 12, 2022
Merged

fix #956 improve get_golem_options doc #957

merged 3 commits into from
Dec 12, 2022

Conversation

VincentGuyader
Copy link
Member

@VincentGuyader VincentGuyader commented Dec 12, 2022

new doc is :

# Define and use golem_options
if (interactive()) {
  # 1. Pass parameters directly to `run_app`

  run_app( title="My Golem App", 
           content = "something" )

  # 2. Get the values 
  # 2.1 from the UI side

  h1(get_golem_options("title"))

  # 2.2 from the server-side

  output$param <- renderPrint({
    paste("param content = ", get_golem_options("content"))
  })
  
  output$param_full <- renderPrint({
     get_golem_options() # list of all golem options as a list.
  })
  
  # 3. If needed, to set default value, edit `run_app` like this :

  run_app <- function(
             title = "this",
             content = "that",
             ...
  ) {
    with_golem_options(
      app = shinyApp(
        ui = app_ui,
        server = app_server
      ),
      golem_opts = list(
      title = title,
      content = content,
      ...
      )
    )
  }
   
  
}

@VincentGuyader VincentGuyader merged commit 135560b into dev Dec 12, 2022
@VincentGuyader VincentGuyader deleted the fix_956 branch January 20, 2023 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant