Re: Question for Pete regarding Javascrip transpiler
- Posted by petelomax in February
- 488 views
A little while ago you did some demos (I think) showing Phix running in a web page (some widgets, and a fern I think)
How is this aspect of Phix going? Are those demos still available? How do I find them? Are there any docs or special instructions I can read? Any special set up instructions?
Not much has changed. There's a list at https://rosettacode.org/wiki/Category:Phix/online - some bitrot, most notably the filter() builtin got moved, but nothing serious.
On that page you'll also find a link to 1,257 entries (including the 100 it has) that should run fine in a browser, or you can search demo\rosetta for "with javascript_semantics".
Fire up pwa/p2js.exw and open an example or paste/type in some code (Ctrl S may be needed to update syntax colouring, error handling is still a bit brutal).
Press Run to open it in your browser. Back in pwa/p2js, Ctrl W will show you the code it has put in pwa\test.htm and the first thing you'll see is a list of the support files it needs.
If you upload all of those onto a server, like I did for the 100 linked above, then anyone should be able to run them, at least that is in a reasonably up-to-date browser.
So it is just test.htm (renamed) + p2js.js + pGUI.js + pGUI.css + builtins/*.js (59 files, from Phix/pwa/builtins), as the complete list of things that might need to be uploaded.
Note that xpGUI is still very much in progress and not ready for general use, but the untouched pGUI code (if it ever existed) should still be available in the same file as a comment.
The reason I ask is that I've been playing with endbasic - write the code online, save the code online, run the code online, and I had a bit of a lightbulb moment. Could something similar be done with Phix?
The plan is (and has been all along) to get pwa/p2js.exw running in a web browser, one day...
Let me know if you find any bits of endbasic that look like they might be useful, esp server-side php.