The responsibility of setting this value belongs in the render loop. Either wait for the loop to update this on a timeout, or force a re-render of the page at the end of the event.