| 1 |
|
| 2 |
|
| 3 |
# Call an application hook. Application hooks are provided so that front ends |
| 4 |
# can know when a Shiny application is running: |
| 5 |
# |
| 6 |
# shiny.onAppStart -- called when an application begins running |
| 7 |
# shiny.onAppStop -- called when an appliation stops |
| 8 |
# |
| 9 |
# Both hooks are passed the url where the application is accessible (appUrl). |
| 10 |
# Note that the appUrl can be NULL if the application was run on a UNIX domain |
| 11 |
# socket rather than a TCP/IP port/ |
| 12 |
callAppHook <- function(name, appUrl) { |
| 13 |
for (hook in getHooksList(paste0("shiny.", name))) |
| 14 |
hook(appUrl) |
| 15 |
} |
| 16 |
|
| 17 |
# The value for getHook can be a single function or a list of functions, |
| 18 |
# This function ensures that the result can always be processed as a list |
| 19 |
getHooksList <- function(name) { |
| 20 |
hooks <- getHook(name) |
| 21 |
if (!is.list(hooks)) |
| 22 |
hooks <- list(hooks) |
| 23 |
hooks |
| 24 |
} |