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

Function makeScreen

packages/effect/src/ui/RouterStack.ts:301–320  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

299// Built on the first `Screens`, so an app that only uses `layer`, such as
300// a native one, doesn't bundle it.
301const makeScreen = () => {
302 const DrawSchema = Schema.declare((u): u is Draw => typeof u === "function")
303 return Component.define({
304 name: "Screen",
305 props: Schema.Struct({
306 entry: Entry(Schema.Unknown),
307 covered: Schema.Boolean,
308 draw: DrawSchema
309 }),
310 model: Schema.Null,
311 message: Schema.Never,
312 restore: false
313 }).make({
314 init: () => null,
315 update: ($) => $.model,
316 // Only the top screen reaches the head.
317 head: ($) => $.props.covered ? hidden : none,
318 view: (s) => s.props.draw(s, s.props.entry, s.props.covered)
319 })
320}
321
322let screen: ReturnType<typeof makeScreen> | undefined
323

Callers 1

ScreensFunction · 0.85

Calls 4

defineMethod · 0.80
EntryFunction · 0.70
makeMethod · 0.65
declareMethod · 0.45

Tested by

no test coverage detected