dropdownDepend.js

There is quite a lot of code in this section doing quite a lot of different things, so we'll step through each chunk in turn:

<script type="text/javascript"> 
  // Shiny function to receive messages 
  Shiny.addCustomMessageHandler("sendMessage", 
    function(message) { 
      // call this before modifying the DOM 
      Shiny.unbindAll(); 

The first part carries out two functions; Shiny.addCustomMessageHandler("sendMessage", function(message){...}) registers the message-handler with Shiny. The "sendMessage" name was defined in the server.R function in the session$sendCustomMessage(type = 'sendMessage', message = theNumber) call. This is the first step in receiving and processing messages from the server.

The second part begins the process of reading ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.