MCPcopy Create free account
hub / github.com/Effect-TS/effect / createOutlet

Function createOutlet

packages/effect/src/ui/internal/kernel.ts:1737–1767  ·  view source on GitHub ↗
(
  inst: Instance,
  view: View.Outlet,
  parent?: unknown
)

Source from the content-addressed store, hash-verified

1735}
1736
1737const createOutlet = (
1738 inst: Instance,
1739 view: View.Outlet,
1740 parent?: unknown
1741): Rec => {
1742 if (dev) checkDeclarer(inst, view)
1743 const declarer = inst.parent!
1744 const content = slotOf(inst, view.name)
1745 const rec = new Rec(view, undefined, undefined, inst)
1746 inst.live++
1747 ;(inst.placed ??= new Map()).set(view.name, { rec, content })
1748 const outer = slot
1749 const from = born.length
1750 const fallbacks = shown
1751 slot = inst.path + "/" + slotSegment(view.name)
1752 try {
1753 const views = contentOf(view, content)
1754 const kids: Array<Rec> = rec.kids = new Array(views.length)
1755 for (let index = 0; index < views.length; index++) {
1756 kids[index] = create(declarer, views[index]!, parent)
1757 }
1758 if (dev && shown !== fallbacks) checkShown(slot, kids, true)
1759 } catch (error) {
1760 orphans(from)
1761 rec.kids = [create(declarer, emptyText)]
1762 failLater(declarer, error)
1763 } finally {
1764 slot = outer
1765 }
1766 return rec
1767}
1768
1769/** @internal */
1770export const pairs = (

Callers 1

createFunction · 0.85

Calls 9

checkDeclarerFunction · 0.90
slotSegmentFunction · 0.90
checkShownFunction · 0.90
orphansFunction · 0.85
failLaterFunction · 0.85
slotOfFunction · 0.70
contentOfFunction · 0.70
createFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected