It's like a Turbolink, but a little less wasteful. It currently only supports links, but to be honest, that's the part I use PJAX/Turbolinks for anyway.
This is a demo, but I could imagine publishing this as a library. I've added a search field, so you can enter something to see that this doesn't change when you click a link. There is also a link to a file that doesn't exist so you can see the error handling.
Run:
npm i
npm run watch
and visit http://localhost:8080
For the lazy ones, you can also visit: http://electric.dohmen.io