iframe.render(() => {}) - Every time you display a visible iframe, we want to ensure that it doesn't flicker or flash when there are changes in related data
A good example of this is the 'card_body_section' (iframe within the body of an open card). When addon data changes within the card context, you may need to adjust the display, but we don't want to reload your iframe as it could cause visual artifacts.
Instead, you should ensure that any logic updating your user interface resides within 'iframe.render'. We'll call iframe.render whenever something changes that, in our view, affects the iframe's display.
Return value - Void
const iframe = Addon.iframe();
const testLogField = document.getElementById('logText');
iframe.render(() => {
iframe.getData('card', 'private', 'timerLog')
.then((response) => {
if (response) {
testLogField.value = response;
}
});
});
// In this case, if addon data within the card context changes, the value of the DOM element #logText will be updated