import { isPc } from "@queenjs/utils";

export function initViewportSize() {
  function setScale() {
    let meta = document.querySelector("meta[name=viewport]") as HTMLMetaElement;
    if (!meta) {
      meta = document.createElement("meta");
      meta.name = "viewport";
      document.head.appendChild(meta);
    }
    meta.content = `width=375,initial-scale=${window.outerWidth / 375}`;
  }
  if (!isPc()) {
    window.addEventListener("resize", setScale);
    setScale();
  }
}
