Function: adopt()
adopt(
setup):Adoption
Defined in: adopt.ts:70
Adopt a durable resource into this component's lifetime.
Call it in the component body (ref={adopt(…)} is exactly that — JSX expressions are evaluated while the component runs, so the owner is present) and it returns a ref callback. setup receives the host element and may return a release function, which runs when the component is disposed.
If there is no owner — because someone called this at module scope, or from inside another ref callback — it says so loudly rather than leaking silently. That is the entire reason this exists.
Parameters
setup
(host) => Release