Skip to content

createWindowPoolDefinition

const createWindowPoolDefinition: (shape, config?, options?) => WindowPoolDefinition = createWindowPool

Defined in: renderer/PooledWindow.tsx:110

Create a pool definition. The shape props (transparent, frame, etc.) are fixed for all windows in this pool — consumers cannot override them per-use.

Call this once at module level and reuse across renders.

PoolShape

Immutable creation-only props shared by all pool windows

WindowPoolConfig

Pool sizing and eviction config

Additional options

InjectStylesMode

How to inject styles into pool windows.

  • “auto”: Copy
  • false: No injection (for CSS-in-JS frameworks)
  • function: Custom injection (REPLACES auto mirroring)

WindowSetupCallback

Per-window setup hook. Runs once for each window the pool creates (including pre-warmed idle windows), after <base>, styles, and the #root portal container are in place — and before React portals any content in. Must be synchronous. Use it for realm-specific initialization on the child window — custom element registration, prototype patches, etc. Additive: runs regardless of injectStyles mode. Optionally return a cleanup function; it runs when the window is destroyed. See WindowSetupCallback for the full contract.

WindowPoolDefinition