Updating outputs when typing
subscribe listens to events defining Shiny to update the input value and make it available in the app.
For that purpose we need to define the event listeners to update the app.
- Use event
keyup
if you want to update after a key is released on the keyboard. - Use event
input
if you want to update after copying and pasting any text in the input field or dictating text. - The callback parameter ensures that the new value is captured by Shiny.
subscribe: function(el, callback) {
$(el).on('keyup.customTextBinding input.customTextBinding', function(event) {
callback(true);
}
Name convention used: EVENT_LISTENER.BINDING_NAME