if (FALSE) {
# Set up a callback to display an encouraging dialog whenever
# the user knits a document
handle <- rstudioapi::registerCommandCallback(
"knitDocument",
function() {
rstudioapi::showDialog(
"Achievement",
"Congratulations, you have knitted a document. Well done."
)
})
# Knit the document interactively and observe the dialog
# Later: Unregister the callback
rstudioapi::unregisterCommandCallback(handle)
}
Run the code above in your browser using DataLab