mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Events shiny:visualchange, shiny:conditional, and shiny:recalculating
This commit is contained in:
@@ -471,6 +471,8 @@ ShinySession <- R6Class(
|
||||
|
||||
obs <- observe({
|
||||
|
||||
self$sendCustomMessage('recalculating', list(name = name))
|
||||
|
||||
value <- try(
|
||||
{
|
||||
tryCatch(
|
||||
|
||||
@@ -253,7 +253,12 @@ function initShiny() {
|
||||
}
|
||||
});
|
||||
$('.shiny-bound-output').each(function() {
|
||||
$(this).data('shiny-output-binding').onResize();
|
||||
var $this = $(this), binding = $this.data('shiny-output-binding');
|
||||
$this.trigger({
|
||||
type: 'shiny:visualchange',
|
||||
binding: binding
|
||||
});
|
||||
binding.onResize();
|
||||
});
|
||||
}
|
||||
var sendImageSizeDebouncer = new Debouncer(null, doSendImageSize, 0);
|
||||
|
||||
@@ -310,6 +310,10 @@ var ShinyApp = function() {
|
||||
var show = condFunc(scope);
|
||||
var showing = el.css("display") !== "none";
|
||||
if (show !== showing) {
|
||||
el.trigger({
|
||||
type: 'shiny:conditional',
|
||||
show: show
|
||||
});
|
||||
if (show) {
|
||||
el.trigger('show');
|
||||
el.show();
|
||||
@@ -503,6 +507,14 @@ var ShinyApp = function() {
|
||||
}
|
||||
});
|
||||
|
||||
addCustomMessageHandler('recalculating', function(message) {
|
||||
if (message.hasOwnProperty('name')) return;
|
||||
$('#' + message.name).trigger({
|
||||
type: 'shiny:recalculating'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Progress reporting ====================================================
|
||||
|
||||
var progressHandlers = {
|
||||
|
||||
Reference in New Issue
Block a user