July 1, 2024
Edited September 9, 2024

Interesting Qwik Things

  • Get access to window
    • document.defaultView after useOn within component
    • investigate using the user agent to get this information on the server
  useOnWindow(
    ["resize", "DOMContentLoaded"],
    $((e) => {
      let window: Window;
      if (e.target instanceof Window) {
        window = e.target;
      } else {
        window = (e.target as Document).defaultView as Window;
      }
      const isLargeScreen = window.innerWidth > 768;

      if (isLargeScreen) {
        navigationClicked.value = true;
      }
      isDesktop.value = isLargeScreen;
    })
  );

Animations not restarting on animate.

Signals bind to existing elements and when they update the underlying html, they don’t redraw the html, they just change it’s contents. This means that the the animations that were running on the page don’t reset between navigations, causing my titles to remain static between navigations.