https://futureofcoding.org/ logo
e

Erik Stel

09/17/2023, 5:00 PM
CodeParadise is a (Pharo) Smalltalk project to create web applications using Smalltalk only (and HTML/CSS 😉). A tiny Smalltalk image runs inside the browser and performs all the UI logic. Normally applications created with CodeParadise have a highly interactive character and communicate with a server environment. A new feature allows a running tiny image to be saved and restarted later as a Single Page Application. A sealed snapshot is made, meaning the connection with the server environment is removed. All code running inside the browser (in the tiny image) is saved in the snapshot as well as the current DOM. After the snapshot is restarted the application will create the same DOM structure and rehydrate the WebComponents and you'll have a running application again! For a short video see:

https://youtu.be/9YUXYuo_HaM

Or go to the resulting SPA at: https://codeparadise.nl/blog-example (open the browser inspector to see all the WebComponents) Happy coding!
a

alltom

09/17/2023, 9:41 PM
I would like to know more! Is there a writeup?
I'm curious how robust it is. I imagine it's robust to within-Pharo concerns, like if an animation is running when you save an image. If a browser extension injects itself, does it become part of the image? If a browser extension moves things around in the DOM, does that affect the image? Or are images created from the browser just best-effort and only those created from the Pharo environment are to be trusted?
e

Erik Stel

09/19/2023, 8:00 PM
Hi @alltom. Good questions. It is mostly Pharo/CodeParadise specific. If a WebComponent uses a JS lib it should take care to reinstall during rehydration (post snapshot in Smalltalk lingo), which will probably happen automatically. But browser plugins are not considered. If these insert DOM elements, the DOM elements will be copied (a document.innerHtml is kept). But any events registered on it will be lost. Only (CodeParadise) WebComponents will reinstall their event handlers. So extra effort should be put into supporting a broader range of applications if that is needed. Any (running) animations created using Smalltalk code will be saved and finalise their animation after the snapshot is restarted. I had that in the demo but removed it because it did not seem relevant enough :-).