This makes it possible for packaged Shiny components to only ask
for the session variable to get access to all inputs and outputs
(along with the other good stuff on session).
Accept this as a parameter from the runApp() function and pass it through into the shinysession object so that it can be used in file uploads, downloads, and HTTP image fallbacks on non-websocket browsers.
- If an output is bound in the UI before it exists on the server, the
server will suspend the new output until something else causes
manageHiddenOutputs to be triggered. The refactor in shiny.R sets
the suspended flag to .shouldSuspend.
- As part of the previous refactor, we don't set suspendOnHidden in
defineOutput; instead we leave it empty and .shouldSuspend knows
what the default should be.
- In shiny.js, unbound controls were not being suspended. This was
fixed by having sendOutputHiddenState be stateful; anything in
a visible state that disappears on the next iteration is marked
as hidden. Also unbindAll now calls sendOutputHiddenState.
With this commit, runApp can now accept a list instead of a path.
This list should have elements named "ui" and "server" that contain
what would normally go in shinyUI and shinyServer, respectively.
(Note that there is no equivalent to global.R, nor should there
need to be since you can just directly execute in the global env
before calling runApp.)
Example:
runApp(list(
ui = bootstrapPage(
numericInput('n', 'Number of obs', 100),
plotOutput('plot')
),
server = function(input, output) {
output$plot <- renderPlot({ hist(runif(input$n)) })
}
))
The simple fix for this would've been to just guess the content
type on the server (or use empty string or something), but by
doing the fix this way we're also set up to handle uploads by
servers that don't allow custom headers on AJAX calls.
The onHeaders callback is supposed to be able to stop large uploads before
they begin, but do not appear to be having the desired effect. The browsers
continue uploading until completion, before noticing the response. To work
around this for now, upload the sizes explicitly when the job begins and
let Shiny pre-emptively reject the whole thing. This is also beneficial
in cases where multiple files are being uploaded and not all of them
exceed the maximum upload size.