Lifecycle

updateDone

updateDone returns a promise that resolves once the current update cycle, if any, is complete:

class MyExample extends Wafer {
static get template() {
return '<span id="firstname"></span>';
}

static get props() {
return {
firstname: {
type: String,
targets: [
{
selector: "$#firstname",
text: true,
},
],
},
};
}
}

customElements.define(`my-example`, MyExample);
const el = new MyExample();

el.firstname = "Ada";

console.log(el.shadowRoot.querySelector("#firstname").textContent);
// logs '' (the template has not been updated yet')

await el.updateDone();

console.log(el.shadowRoot.querySelector("#firstname").textContent);
// logs 'Ada' (the template has now been updated')
Next: Helpers Previous: firstUpdated