![]() ![]() Most of the time, when the JavaScript side of the websocket receives one of these events, the page the user sees is modified (for example, a plot is drawn). What happens under the hood is a little bit complex and out of scope for this book, but the general idea is that R talks to your browser through a web socket (that you can imagine as a small “phone line” with both software listening at each end, both being able to send messages to the other), 66 and this browser talks to R through the same web socket. Later on, when the app is launched, shiny binds events to UI elements, and these JavaScript events will communicate with R, in the sense that they will send data to R, and receive data from R. That being said, note also that every inclusion of external JavaScript code or library can present a security risk for your application, so don’t include code you don’t know/understand in your application unless you are sure of what you are doing.Īs a rule of thumb, always go for an existing and tested solution when you need JavaScript widgets/functionalities, instead of trying to implement them yourself. 2020), when you get better at writing JavaScript. It can also help you extend shiny with other JavaScript libraries, for example, using htmlwidgets (Vaidyanathan et al. We chose to include this chapter in this book as it will help you get a better understanding on how shiny works at its core, and show you that getting at ease with JavaScript can help you get better at building web applications using R in the long run. 2020) application without ever writing a single line of JavaScript code.Įven more when you can use a lot of tools that already bundle JavaScript functionalities: a great example of that being shinyjs (Attali 2020), which allows you to interact with your application using JavaScript, without writing a single line of JavaScript. ![]() Note you can build a successful, production-grade shiny (Chang et al. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |