Edit this page

up.syntax up.destructor(element, destructor)
JavaScript function

Registers a function to be called when the given element is destroyed.

An alternative way to register a destructor function is to return it from your compiler function.


up.compiler('.current-time', function(element) {
  let update = () => element.textContent = new Date().toString()
  setInterval(update, 1000)
  up.destructor(element, () => clearInterval(update))


element Element
destructor FunctionorArray<Function>

One or more destructor functions.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more