The list of children, either an array of VirtualDOM or a stream of array of VirtualDOM ( see children$ for this last case).
This method gets called when the VirtualDOM get inserted as actual DOM in the HTML page (i.e. transformed into ).
This is when the view's observables are actually subscribed. A typical usage is to transfer the ownership of some subscriptions to the virtual DOM such that they get properly unsubscribed when the element is removed from the page:
let clicked$ = new rxjs.BehaviorSubject({clicked: false})
let vDOM = {
tag: 'div',
connectedCallback: (elem: HTMLElement$) => {
// the ownership of sub0 is given to the VirtualDOM
// => it will be unsubscribed when element is actually removed from the view
elem.ownSubscription(clicked$.subscribe( (d) => console.log(d)))
}
children: [
{
tag:'button',
innerText: 'hello flux view',
onclick: () => clicked$.next({clicked: true})
}]
}
This method get called when the actual DOM represented by the VirtualDOM gets removed from the HTML page.
tag of the virtual DOM, e.g. div, span, table, etc The list of available tags are presented here
Generated using TypeDoc
This is a virtual representation of a DOM element:
When the Virtual DOM is rendered, it is transformed into a HTMLElement$ : a custom HTML element that inherits from HTMLElement.
Here is an instance of static VirtualDOM:
The difference with a regular DOM is that a virtual DOM can have both attributes and children binded to a RxJS observables using attr$, child$ and children$: