Type specialization of stream$ for TDom = AttributeType
let domain$ : Observable<{name:string}>
let vDOM = {
tag: 'div',
innerText: attr$(
domain$,
({name}) => name,
{ wrapper: (name) => 'Hello '+ name,
sideEffects: (vDom, htmlElem) => console.log(vDom, htmlElem),
untilFirst: 'No name available yet'
}
)
}
Type specialization of stream$ for TDom = VirtualDOM
let domain$ : Observable<{name:string}>
let vDOM = {
tag: 'div',
children:[
child$(
domain$,
({name}) => ({innerText: 'Hello '+ name}),
{ sideEffects: (vDom, htmlElem) => console.log(vDom, htmlElem),
untilFirst: ({innerText: 'No name available yet'})
}
)
)
}
Type specialization of stream$ for TDom = Array<VirtualDOM>
let domain$ : Observable<{name:string}>
let vDOM = {
tag: 'div',
children: children(
domains$,
({name}) => [{innerText: 'Hello'}, {innerText: name}),
{ sideEffects: (vDom, htmlElem) => console.log(vDom, htmlElem),
untilFirst: []
}
)
}
domain's data stream defined as a RxJS observable
function that convert the domain's data to a vDOM attribute:
is a function that provides a handle to execute side effects once the attribute/child as been set/added; both the domain's data and the rendered HTMLElement are provided to this function. For instance, a use case would be to focus an input after being dynamically added to the DOM.
is the data that will be used until the first emitted element in stream$ is obtained. If not provided, the attribute/child does not exist until first emission. In such case, using a BehaviorSubject of RxJS (observable that directly emit a predifined value) is an alternative that can also be used.
is a function that is used to alter the data returned by vDomMap. It is often used to factorize part of the viewMap function that are 'constant' with respect to the data in $stream$*
a stream usable in VirtualDOM
Generated using TypeDoc
Type alias for attributes in VirtualDOM