scittle 2023-04-15

greetings friends! i'm working on contributing a hoplon plugin (assuming interest, nbd if not) and i've hit a little puzzler in sci.configs test. looks like there aren't js/window or js/Elementwhich hoplon core.cljs needs to do stuff (like extending a protocol to Element). looks like Node is the environment there. should i investigate adding a shim? or something else? thanks in advance for guidance 🙏

@alandipert hey! js/window should work, but you have to enable global access in SCI with:

{:classes {:allow :all 'js js/globalThis}}

This is enabled in scittle, but maybe not in sci configs tests? Is that what you run into?

possibly, yes it's the sci configs test that has the issue

ah, i see, that goes in the same map where :namespaces

so, i graduated to ReferenceError: Element is not defined

Maybe this is because you're running in Node.js instead of a browser?

Upgrading SCI might help here btw, if it's supposed to work in Node

I bumped SCI on the main branch

almost certainly because Node, hence my thinking about a shim.. hoplon definitely currently requires a browser environment because it extends a protocol to a browser thing (Element)

but do i understand right that this is a hurdle for the test but not necessarily hoplon ultimately working in scittle?

fwiw i'm blindly copypasting from stuff i see for reagent/reframe 🙈

sci.configs is currently tested with Node.js, but maybe we should include a browser test as well... shim would be ok with me

👍 1

scittle works in the browser

if your goal to provide a hoplon playground?

if i can get this working i'll probably just use hoplon this way for all my stuff

happier than most to avoid build tooling when possible

➕ 3

thanks very much for your assistance, i'll see about a shim and follow up eventually with a PR

👍 1

btw I'm also working on a follow up to SCI which is more like a compiler than an interpreter: https://github.com/squint-cljs/cherry/blob/main/doc/embed.md so maybe eventually I'll port scittle over to that as well (while not deprecating scittle) for better performance, although performance with SCI ain't that bad for typical web-app stuff (see e.g. this pinball game made with scittle: https://thegeez.net/static/pinball/pinball.html)

@alandipert if it helps you can also include a Node.js shim library in package.json

Thanks, that's the direction I had in mind also

This is all very cool and exciting btw, really appreciate your efforts!

🙏 1