Understand Golden Layout component binding methods
masterGolden Layout supports four distinct ways to bind components, which determine how the library manages their lifecycle, DOM positioning, and visibility:
- Embedding via Registration (Classic): You register a constructor or factory. Golden Layout instantiates the component and manages its DOM placement. Note that component ancestors may be reparented during layout changes.
- Embedding via Events: Components are fetched on demand via event handlers. This provides more control over allocation while still allowing Golden Layout to manage the DOM hierarchy.
- Virtual via Registration: A component's constructor is registered, but it uses virtual positioning logic. Golden Layout handles events internally.
- Virtual via Events (Virtual Components): The application has full control over construction, destruction, and DOM placement. Golden Layout only advises the application via events when components are needed, no longer needed, or when their position changes. This prevents component ancestors from being reparented during layout changes.