I noticed view.mounted
property and thought it would be a way to detect if the view.dom
is actually part of the current page document, but it always is false
.
What’s its real purpose?
I noticed view.mounted
property and thought it would be a way to detect if the view.dom
is actually part of the current page document, but it always is false
.
What’s its real purpose?
From the constructor source
if (place) {
if ((place as DOMNode).appendChild) (place as DOMNode).appendChild(this.dom)
else if (typeof place == "function") place(this.dom)
else if ((place as {mount: HTMLElement}).mount) this.mounted = true
}
Where place is the element you want to mount in. Basically place can be an object with a mount
property, if that’s the case you get that feedback you’re looking for.
Also, since this isn’t in the public, documented interface, as a general rule you shouldn’t worry about it when writing client code.