MCPcopy Create free account
hub / github.com/brillout/react-streaming / getInitData

Function getInitData

src/client/useAsync.ts:43–55  ·  view source on GitHub ↗
(key: string, elementId: string)

Source from the content-addressed store, hash-verified

41
42// See provider `provideInitData()`
43function getInitData(key: string, elementId: string): InitData | null {
44 const elements = Array.from(window.document.querySelectorAll(`.${initDataHtmlClass}`))
45 for (const elem of elements) {
46 assert(elem.textContent)
47 const initData = parse(elem.textContent) as InitData
48 assert(typeof initData.key === 'string')
49 assert(typeof initData.elementId === 'string')
50 if (initData.key === key && initData.elementId === elementId) {
51 return initData
52 }
53 }
54 return null
55}

Callers 1

resolverSyncFunction · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…