private constructor()

in src/helper/dom.ts [86:105]


  private constructor (rootSelector: string) {
    this.root = DS(rootSelector)[0] as ExtendedHTMLElement;
    this.extendDomFunctionality(this.root);
    this.root.addClass('mynah-ui-root');
    this.rootFocus = this.root.matches(':focus') ?? false;
    this.attachRootFocusListeners();
    if (ResizeObserver != null) {
      this.rootBox = this.root.getBoundingClientRect();
      this.resizeObserver = new ResizeObserver((entry) => {
        const incomingRootBox = this.root.getBoundingClientRect();
        // Known issue of ResizeObserver, triggers twice for each size change.
        // Check if size was really changed then trigger
        if (this.rootBox.height !== incomingRootBox.height || this.rootBox.width !== incomingRootBox.width) {
          this.rootBox = incomingRootBox;
          MynahUIGlobalEvents.getInstance().dispatch(MynahEventNames.ROOT_RESIZE, { clientRect: this.rootBox });
        }
      });
      this.resizeObserver.observe(this.root);
    }
  }