> Am 18.09.2017 um 09:03 schrieb Craig Latta <[hidden email]>: > > > Hi Sean-- > >> I'd like to create HTML via a DSL, like Seaside's canvas builder, but >> without loading a whole web framework. Any ideas? > > In Pharo on the SqueakJS virtual machine in a web browser[1], I > sketch with live DOM objects, and write them out as HTML. This way, the > DSL is the actual JavaScript DOM API which is sitting in the web browser > anyway, although driven with Smalltalk messages over the JS bridge. I'm > also assured that everything I do with the DOM objects is legitimate, > and I can handle DOM API errors live in Smalltalk. > > Norbert > -C > > [1] https://caffeine.js.org/pharo > > -- > Craig Latta > Black Page Digital > Amsterdam :: San Francisco > [hidden email] > +31 6 2757 7177 (SMS ok) > + 1 415 287 3547 (no SMS) |
Hi Norbert-- > > In Pharo on the SqueakJS virtual machine in a web browser[1], I > > sketch with live DOM objects, and write them out as HTML. This way, > > the DSL is the actual JavaScript DOM API which is sitting in the web > > browser anyway, although driven with Smalltalk messages over the JS > > bridge. I'm also assured that everything I do with the DOM objects > > is legitimate, and I can handle DOM API errors live in Smalltalk. > > Sure you can do the same with PharoJS. Really? I wasn't aware that one can livecode JS objects with PharoJS, only that PharoJS generates JS source which eventually runs in a browser. Can you give an example? > But there are scenarios where you want to have DOM actions without > having a browser. Oh, it wasn't clear to me that this was one of Sean's requirements. thanks, -C -- Craig Latta Black Page Digital Amsterdam :: San Francisco [hidden email] +31 6 2757 7177 (SMS ok) + 1 415 287 3547 (no SMS) |
I wrote: > I wasn't aware that one can livecode JS objects with PharoJS, only > that PharoJS generates JS source which eventually runs in a browser. > Can you give an example? Well, I evaluated the PharoJS playground expressions, and browsed around the proxy support in the index.js that gets installed in a web browser. I could inject the PjLoadForTest class into the web browser and invoke its JS functions via Smalltalk messages from Pharo. I could send #at:put: to the exposed "window" proxy of the web browser (as long as the arguments were JS literals or proxies), and I could also inspect the "document" proxy, but I got an exception when I tried to invoke document.getElementWithId (via "bridge evalBlock: [document getElementById: 'someID']"). Are arbitrary JS messages supposed to work? There isn't much exception handling support beyond relaying JS error messages. (I guess one way to go would be to use the Chrome Debugging Protocol.) I didn't see how to refer to Smalltalk objects from JS (only JS objects from Smalltalk), so it seems the only Smalltalk blocks one can use as JS callback functions are those which only use objects and functions in JS-land. This might be okay for smoke-testing PharoJS apps, but I think the kind of interactive DOM object sketching I mentioned before would be uncomfortable. -C -- Craig Latta Black Page Digital Amsterdam :: San Francisco [hidden email] +31 6 2757 7177 (SMS ok) + 1 415 287 3547 (no SMS) |
Administrator
|
In reply to this post by Craig Latta
Craig Latta wrote
> Oh, it wasn't clear to me that this was one of Sean's requirements. I would say "sorry" but I'm glad I wasn't clear because I learned something cool from your reply ;) ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Cheers,
Sean |
Free forum by Nabble | Edit this page |