Skip to content

ProxyComponent

Compare
Choose a tag to compare
@tdumitrescu tdumitrescu released this 13 Apr 00:18
· 362 commits to master since this release

Adds the ProxyComponent wrapper for switching between different component implementations at runtime, e.g.:

class MyWidget extends ProxyComponent {
  getTargetElementTag() {
    if (window.location.search.includes('enable_beta') {
      return 'my-widget-v2';
    } else {
      return 'my-widget-v1';
    }
  }
}

Other optional component utilities such as StateController and ControlledComponent have been moved into lib/component-utils, but are still exported at top level (so can still be imported like import {ProxyComponent, StateController} from 'panel';). This will however affect consumers which import directly from panel/build/ (which is not a public API and is not recommended).