forked from stenciljs/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.ts
More file actions
35 lines (32 loc) · 792 Bytes
/
Copy pathrender.ts
File metadata and controls
35 lines (32 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type * as d from '../declarations';
import { renderVdom } from './vdom/vdom-render';
/**
* Method to render a virtual DOM tree to a container element.
*
* @example
* ```tsx
* import { render } from '@stencil/core';
*
* const vnode = (
* <div>
* <h1>Hello, world!</h1>
* </div>
* );
* render(vnode, document.body);
* ```
*
* @param vnode - The virtual DOM tree to render
* @param container - The container element to render the virtual DOM tree to
*/
export function render(vnode: d.VNode, container: Element) {
const cmpMeta: d.ComponentRuntimeMeta = {
$flags$: 0,
$tagName$: container.tagName,
};
const ref: d.HostRef = {
$flags$: 0,
$cmpMeta$: cmpMeta,
$hostElement$: container as d.HostElement,
};
renderVdom(ref, vnode);
}