The code here is pretty simple:
observeEvent(input$buttonClick, {
js$buttonClick(input$color, input$size)
})
We've seen the observeEvent() function before; it simply listens for the input$buttonClick action button. The js() function is doing all the work; it sends its arguments to the shinyjs.buttonClick function within the JavaScript file (which we will look at next). In general, js$foo sends its arguments to shinyjs.foo in the defined JavaScript.