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

Class EffectUIContext

packages/ui/native/apple/EffectUIHost.swift:55–75  ·  view source on GitHub ↗

Emits events and requests size updates for a hosted element.

Source from the content-addressed store, hash-verified

53
54/// Emits events and requests size updates for a hosted element.
55@MainActor
56public final class EffectUIContext {
57 private let send: (String, [String: Any]) -> Void
58 private let resize: () -> Void
59
60 init(emit: @escaping (String, [String: Any]) -> Void, invalidateSize: @escaping () -> Void) {
61 send = emit
62 resize = invalidateSize
63 }
64
65 /// Fires the handler bound to `name`. Payload values must be JSON-compatible.
66 public func emit(_ name: String, _ payload: [String: Any] = [:]) {
67 send(name, payload)
68 }
69
70 /// Rereads `intrinsicContentSize` and updates layout if the size changed.
71 /// Explicit style dimensions still take precedence.
72 public func invalidateSize() {
73 resize()
74 }
75}
76
77/// Registers native views that JS renders with `Native.hostedView`.
78@MainActor

Callers 1

initMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected