Run Cuis in the Web Browser. (SqueakJS)

From Cuis CookBook
Revision as of 13:07, 3 May 2025 by Nmingott (talk | contribs) (added links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CAVEAT. This is very much alpha, don't take it for granted it will run every day ;)

  • You can run Cuis in the Web browser using SqeuakJS clicking this link : CuisJS
  • You can see important debugging messages in your browser developer console.
  • It is not very snappy, be prepared to wait long times.
  • When you load CuisJS the first time it comes with only the .image and .changes files. To load all the base Cuis directories as Documentation, Features, Core-updates etc. you need to run the following snippet. ATTENTION, this is going to take about 10 minutes to complete.
Feature require: 'CuisJS'. 
CuisJS installDataDirs.
  • If you Save the image you can then visit CuisJS and have it running with all files and directories in less then 1 minute !
  • This version of Cuis will be always in sync with Juan repository. If possible I will try to check for updates every 5 minutes.
  • CuisJS virtual machine is SqueakJS with a few primitives more (just one now). For the moment I will not try to keep in sync with SqueakJS but ideally I will in the future.

How does it work ?

  • With your browser you load the page: cuis.html. That loads jQuery and SqueakJS, then it runs SqueakJS passing there files:
    • Cuis-XXX.image
    • Cuis-XXX.changes
    • Cuis-XXX.sources
    • CuisJS.pck.st . My helper package.
    • Compression.pck.st . Needed because I what to decompress stuff coming from the server.
    • 'UnsavedChangesTo-Compression-NM.001.cs.st' . A correction to Compression that was not working fine.
  • I added a primitive to SqueakJS (number 902) to let me load text files from the server. The primitive loads the script primitive-902.js and, on success, calls the function getCuisTextFiles(). Don't be fooled by the name, all the files I load are text files, binary are encoded to Base64. This helped me reduce the amount of code to write.
  • 'CuisJS.pck.st' is a helper package to collect useful functions for CuisJS. It is the only package aware of the new primitives i define, for example.

Issues & limitations & TODO

  • If updating the repository I can remove 'UnsavedChangesTo-Compression-NM.001.cs.st', Juan uploaded it to Cuis-Smalltalk-Dev.
  • Load Cuis files and dirs in the same directory where there is the image. Now they are one level below. This could create problems. (mailing Juan 23-Sep-2021).
  • If a new directory is added into Cuis-Smalltalk-Dev, or its subdirectories, this change will not be automatically reflected in CuisJS, because the directory structure was hardcoded in Javascript file primitive-902.js.
  • The image version number is hardcoded into the HTML file cuis.html , it requires Nicola manual intervention if the image version number change.
  • There a way to load files on demand (see maling Vanessa 22-Sep-2010).

Dr. Nicola Mingotti started this page on 19-Sep-2021. I am testing CuisJS in Firefox under Linux mainly.