Called from download handler and used to write a saved state value if that is null
Arguments
- state
ASM state from
ASM_fetch_state()
- session
Shiny session variable
- file_path
File path to write zipped state
- pll
Preload list of the format generated by
FM_mk_app_preload()
. IF set toNULL
it will be generated from the contents of the session variable.
Value
This function only writes the state and returns a list with the following elements:
isgood: Boolean indicating the exit status of the function.
msgs: Messages to be passed back to the user.
Examples
# Within shiny the session variable will exist
# this creates examples here for testing purposes:
sess_res = ASM_test_mksession()
#> → ASM: including file
#> → ASM: source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → ASM: dest: file.path("config","report.docx")
#> → ASM: including file
#> → ASM: source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → ASM: dest: file.path("config","report.pptx")
#> → ASM: including file
#> → ASM: source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → ASM: dest: file.path("config","report.yaml")
#> → ASM: State initialized
#> → ASM: setting word placeholders:
#> → ASM: -> setting docx ph: HEADERLEFT = left header
#> → ASM: -> setting docx ph: HEADERRIGHT = right header
#> → ASM: -> setting docx ph: FOOTERLEFT = left footer
#> → ASM: module isgood: TRUE
session = sess_res$session
state = sess_res$state
ssf = tempfile(fileext=".zip")
ss_res =
ASM_save_state(state, session,
file_path = ssf)
#> → Saving module: ASM
#> → ASM: mk_preload isgood: TRUE
#> → ASM: writing app state to file on server:
#> → ASM: /var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpxxeT0v/filebb1455cb145e.zip
#> → ASM: Generating reports (code only)
#> → ASM: done writing app state