Baking JavaScript into a Shiny Package
summary
Wraps the js-cookie JavaScript library into an R package called cookies that is on CRAN, includes minified JS in inst/js, and adds an HTML dependency that prefers npm but falls back to the bundled files. Implements server-to-client via sendCustomMessage and client-to-server via Shiny.setInputValue, includes a LICENSE.note and tests, and already accepts PRs (one from Jacqueline Nolas); used in R4DS apps (mentor dashboard, book club) and works.
AI-written summary · about
chapters (18)
- 0:00Introduction to talk
- 1:48Why JavaScript matters
- 4:57Why wrap JavaScript in a package
- 7:27r4ds community background
- 12:09Recipe for JavaScript packages
- 12:30Licensing JavaScript libraries
- 14:17Authors and description setup
- 15:45Inst folder and JS files
- 17:30HTML dependency function
- 19:34Custom JavaScript integration
- 20:35Shiny-JavaScript communication
- 21:17Sending messages to JavaScript
- 23:23Receiving messages from JavaScript
- 24:04Handling input types
- 24:48JavaScript event listeners
- 26:14Working with Shiny modules
- 27:39Conclusion and further reading
- 28:43Q&A session
