Let Unpoly pair HTML elements with your custom Javascript behavior. Your elements will automatically be compiled whenever a page fragment is updated.
<p>
The time is <span class="timestamp"></span>
</p>
up.compiler('.timestamp', (element) => {
var now = new Date()
element.innerText = now
})