One of the solutions could be as follows:
RichFaces components API will be exposed on Bridges instead of components:
var bridge = ...;
var autocomplete = this.input.data('autocomplete')
$.each(autocomplete, function(key, value) {
// for public methods
if (key.indexOf('_') !== 0) {
bridge[key] = function() {
autocomplete[key].apply(autocomplete, arguments);
}
}
}
This could be even generalizes to bridge-base.js.
Then, once we reference public methods from widget and expose them to bridge,
we could simplify RichFaces.component method.
Finally, we could expose JSF-facing JavaScript API methods on the bridge:
{
setValue : function(value) {
autocomplete.input.val(value);
}
}
~ Lukas