Hi,
I working on the project - complex Shiny app (many inputs, many conditionalPanels, lots of reactivity).
I would like to get value of 'radioButtons' input (id="test") directly from Shiny.shinyapp.$inputValues['test']
when input changes.
So I binded my code to 'shiny:inputchanged'
event:
$(document).on('shiny:inputchanged', function(event){
console.log(Shiny.shinyapp.$inputValues['test']);
})
and it seems that Shiny.shinyapp.$inputValues
is too slow - it stores not updated value of input. I added setTimeout
to handle this issue:
$(document).on('shiny:inputchanged', function(event){
setTimeout(function(){console.log(Shiny.shinyapp.$inputValues['test'])}, 10);
});
Now it works.
My question - is 10ms timeout setting enough to be sure that $inputValues
is always updated (every time in a complex app)? Or maybe there is a better event which is triggered when $inputValues
is updated?