DEV Community

Momcilo
Momcilo

Posted on

I saw this mind-blowing experiment, so I made a simple version of it

Work by Bjorn Staal 🤯

Two browser windows (acting as socket clients) communicate their:

  • Screen dimensions - (screen.width, screen.height)
  • Window dimensions - (window.innerWidth, window.innerHeight)
  • Window X/Y position - (window.screenX, window.screenY) ...or whichever calculation works best for you.

The original post says Bjorn Staal used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends :)
Here's a demo of how it works, and the codebase:
https://github.com/Momciloo/fun-with-sockets/

Fun with sockets

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay