MCPcopy
hub / github.com/bubkoo/html-to-image / bootstrap

Function bootstrap

test/spec/helper.ts:41–63  ·  view source on GitHub ↗
(
  htmlUrl: string,
  cssUrl?: string,
  refImageUrl?: string,
)

Source from the content-addressed store, hash-verified

39}
40
41export async function bootstrap(
42 htmlUrl: string,
43 cssUrl?: string,
44 refImageUrl?: string,
45) {
46 await setup()
47
48 const html = await fetchFile(htmlUrl)
49 const captureNode = getCaptureNode()
50 captureNode.innerHTML = html
51
52 if (cssUrl) {
53 const css = await fetchFile(cssUrl)
54 getStyleNode().appendChild(document.createTextNode(css))
55 }
56
57 if (refImageUrl) {
58 const url = await fetchFile(refImageUrl)
59 getReferenceImage().setAttribute('src', url)
60 }
61
62 return captureNode
63}
64
65async function fetchFile(fileName: string) {
66 const url = BASE_URL + fileName

Callers 7

svg.spec.tsFile · 0.90
select.sepc.tsFile · 0.90
special.spec.tsFile · 0.90
basic.spec.tsFile · 0.90
video.spec.tsFile · 0.90
options.spec.tsFile · 0.90
canvas.sepc.tsFile · 0.90

Calls 5

setupFunction · 0.85
fetchFileFunction · 0.85
getCaptureNodeFunction · 0.85
getStyleNodeFunction · 0.85
getReferenceImageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…