Simple AJAX system for Shiny apps (JS -> R -> JS communication)
Using this system is easy:
api.js in your Shiny app's UI
api.R in your Shiny app's server
params is an object that contains all the parameters as key-value pairs. You must specify the
_method parameter -- this is the R function that will get called. For example, if in R you defined a function
api.call('_method' : 'myfunc') (notice that the prefix
api. is ommitted). You can optionally provide
_failureCallback functions which can be called when the R function completes or when it throws an error. You can also add any other arbitrary parameters, and they will be available to you in the R function.
This may sound a bit complicated, but if you take a look at the source code of the sample app you'll see it's actually pretty simple to use.