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:
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?
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 :-).