I have a function that posts a message to the parent component after 1 second.
setTimeout(function(){
var widgetHeight = getDocHeight();
parent.postMessage(widgetHeight, hostURL);
}, 1000)
I want to refactor this so that I create a loop that checks the widgetHeight
every 1/10th second and if it changed than post the message to the parent and stop the loop.
How can I do this?