ion behind the scenes after certain functions complete.</p>
<h3 id="after-event-handlers"><a href="#after-event-handlers">After event handlers</a></h3>
<p>Mithril automatically redraws after DOM event handlers that are defined in a Mithril view:</p>
<pre><code class="language-javascript">var MyComponent = {
    view: function() {
        return m(&quot;div&quot;, {onclick: doSomething})
    }
}

function doSomething() {
    // a redraw happens synchronously after this function runs
}

m.mount(document.body,