In a Shiny application, is it possible to have a binding that listens to what key a user presses down?
I'm not too familiar with JavaScript, but I'm looking for something like:
window.onkeydown = function (e) {
var code = e.keyCode ? e.keyCode : e.which;
alert(code);
};
where the key input is then to be used in server.R
, e.g.:
shinyServer(function(input, output) {
output$text <- renderText({
paste('You have pressed the following key:', input$key)
})
# ...
})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…