Skip to content

feat(InputBinding): subscribe callback now supports event priority #4211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Apr 25, 2025

Until now, custom input bindings could only pass a boolean value to their subscribe callback. That is, they all do something similar to this to notify Shiny of a change:

exampleInputBinding.subscribe = function(el, callback) {
  $(el).on("keyup.exampleComponentName", function(event) {
    callback(true); // or false
  });
}

These boolean values effectively map to values of priority: "deferred" (true) and priority: "immediate" (false).

This means, if an input wants to resend their value immediately regardless of whether the value has changed (i.e., priority: "event"), that isn't possible (until now).

The motivator for adding this is for input_submit_textarea() in rstudio/bslib#1204, where it feels like the most desirable behavior is to always resend immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant