Title
#share-your-work
Benjamin Smith

Benjamin Smith

12/22/2021, 3:29 AM
Hi all! New here, I wanted to share something I made over the weekend that I thought some people here might find interesting/have thoughts on. It's a self-hosting web code editor that stores and edits "files" in the browser's IndexedDB and uses a service worker to serve them as if there was an actual backend. You can try it out here (only works in Chromium-based browsers because it uses ES modules in the worker): https://reflection-editor.netlify.app/ Source code is also available at https://github.com/Merlin04/reflection.
🙌 2
👀 3
Florian Schulz

Florian Schulz

12/22/2021, 3:33 PM
Clever!
Tony O'Dell

Tony O'Dell

12/22/2021, 5:10 PM
Benjamin Smith

Benjamin Smith

12/22/2021, 5:28 PM
That's odd, are there any errors in the console?
Matthew Linkous

Matthew Linkous

12/23/2021, 3:14 PM
Is there a way to evaluate/run the code?
Tony O'Dell

Tony O'Dell

12/23/2021, 6:02 PM
Uncaught (in promise) TypeError: ServiceWorker script at <https://reflection-editor.netlify.app/worker.jsm> for scope <https://reflection-editor.netlify.app/> threw an exception during script evaluation.
Benjamin Smith

Benjamin Smith

12/24/2021, 1:44 AM
@Matthew Linkous Right now there's just editing the source and saving/reloading to run the changes, but that would be a useful feature to add for individual script files!
1:44 AM
I'm not sure how I could troubleshoot that script error, I'm going to try to make it not use ES modules in the worker which should reduce compatibility issues
Florian Schulz

Florian Schulz

12/24/2021, 10:30 AM
I haven’t worked with Service Workers, so this is a more general question: would it also be possible to serve images (stored as DataURI) from IndexedDB and have them appear in the network/resources tab (e.g. as
my-file-from-indexeddb.png
)?
11:16 AM
In response to my own question: yes, it is possible to use Service Workers to serve “virtual” synthetic image files from IndexedDB or memory. This is really cool!
Shubhadeep Roychowdhury

Shubhadeep Roychowdhury

12/30/2021, 10:28 AM
I am getting this ...
Benjamin Smith

Benjamin Smith

01/06/2022, 9:07 PM
Oops, forgot to update the link
9:08 PM
The new version (with more features, including Firefox support) is https://reflection-editor.vercel.app