-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtime.ts
37 lines (36 loc) · 1.09 KB
/
runtime.ts
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
36
37
import { Subscription } from 'rxjs'
import { Component, ComponentDescription } from './component.js'
import { RuntimeOptions } from './runtime-model.js'
import buildDomStrategy from './wiring-dom-build.js'
import { runInternal } from './wiring.js'
/**
* Run a Butterfloat component
*
* @param container Container the component will be a child in
* @param component Component or description of component to run
* @param context Optional context for wiring concerns
* @param placeholder Optional placeholder child of the container to replace
* @param document Document to use for creating new nodes
* @returns Subscription
*/
export function run(
container: Element,
component: ComponentDescription | Component,
options?: RuntimeOptions,
placeholder?: Element | CharacterData,
document = globalThis.document,
): Subscription {
const { preserveOnComplete } = options ?? {}
return runInternal(
container,
component,
{
domStrategy: buildDomStrategy,
isStaticComponent: true,
isStaticTree: true,
preserveOnComplete,
},
placeholder,
document,
)
}