MCPcopy
hub / github.com/pinokiocomputer/pinokio / flattenFrameTree

Function flattenFrameTree

full.js:916–932  ·  view source on GitHub ↗
(frame, acc = [], depth = 0)

Source from the content-addressed store, hash-verified

914}
915
916const flattenFrameTree = (frame, acc = [], depth = 0) => {
917 if (!frame) {
918 return acc
919 }
920 let frameName = null
921 try {
922 frameName = typeof frame.name === 'string' && frame.name.length ? frame.name : null
923 } catch (_) {
924 frameName = null
925 }
926 acc.push({ frame, depth, url: normalizeInspectorUrl(frame.url || ''), name: frameName })
927 const children = Array.isArray(frame.frames) ? frame.frames : []
928 for (const child of children) {
929 flattenFrameTree(child, acc, depth + 1)
930 }
931 return acc
932}
933
934const findDescendantByUrl = (frame, targetUrl) => {
935 if (!frame || !targetUrl) {

Callers 2

selectTargetFrameFunction · 0.85
installScreenshotRelaysFunction · 0.85

Calls 1

normalizeInspectorUrlFunction · 0.85

Tested by

no test coverage detected