// apply some style to `my_div` post-creation
const my_div = <div style="background-color: green;" {...{
[ONINIT]: (div_element): void => {
if(div_element.style.backgroundColor === "green") {
div_element.style.backgroundColor = "red"
}
if(div_element.style.backgroundColor === "red") {
div_element.style.backgroundColor = "blue"
}
} as ExecuteProp<HTMLDivElement>
}}>
I'm blue daba dee daba die, If I were green I would die.
</div>
// log when the div element has been destroyed
const my_div = <div style="background-color: green;" {...{
[ONCLEAN]: (div_element): void => {
console.log("eiffel 65 turned green, and died")
} as ExecuteProp<HTMLDivElement>
}}>
I'm blue daba dee daba die, If I were green I would die.
</div>
Generated using TypeDoc
provide a function to execute on the generated output of an HyperRender.h |
Element Rendereras the first argument.this is useful in cases where you may wish to register the element post-creation, or perhaps apply some mutations to the element itself.
or, declare a "on delete" function to execute when the element is being permanently detached. ideally, you should run any cleanup tasks here.