Hey. I pasted the contents of https://cdn.jsdelivr.net/npm/scittle@0.3.10/dist/scittle.js into a https://script.google.com/home script file and the "Execution log" says ReferenceError: window is not defined. Do I need window if I just want eval_string? I'm not really sure how this would work but I wanted to be able to write a Google App Script in clojure (well sci really).
Scittle is specifically made for browsers
What is the runtime environment of Google Apps? Node?
You can maybe get rid of the warning by calling:
scittle.core.disable_auto_eval()
or defining a surrogate window object
The window object isn't referenced directly by scittle but this may be an artifact of how it's compiled by CLJS / shadow-cljs
Something like #squint might work better for something like Google Apps
Ok, thanks.
but also not node right? so you can't run #nbb on there
are you able to run Google Apps locally for testing?
Else the squint method is a bit ugly too, by having to copy paste the output to test every time
I hadn’t thought of nbb.
Creating a special SCI target for Google Apps may work too
nbb assumes Node specific stuff
How would nbb work? I figured with scittle, I’d paste sci as js into an app script.
Yea, I can just try clojurescript to compile to js…
I was trying to find a shortcut or something. Idk.
nbb = SCI + Node.js, scittle = SCI + browser
just compiling a generic :target :esm script with SCI + eval_string should get you there, but if you end up copy pasting JS to a Google Apps console anyway, I'd go with squint since the output is much smaller
$ npx squint-cljs --show --no-run -e "(defn foo [x] (+ x 1 2 3))"
var foo = function (x) {
return (x + 1 + 2 + 3);
}
;
export { foo }Photoshop scripting says it supports Node.js, NPM, and React with ES6. supports a limited version of chromium.
They list these as usupported:
• Drag and drop
• iFrames
• HTML5 Canvas
• window.location
• data attributes and font-face
• unsupported libs
◦ jQuery
◦ Vue.js
▪︎ (although some people have reported success)
• window.event.cancelBubble = true
◦ Instead, use event.stopPropagation()
• getElementsByClassName(something)
◦ Instead, use document.querySelectorAll("something")
Given this which SCI runtime might be most appropriate/powerful?
#squint already seems to work for simple scripts. But I would like to be able to use cljs libs and and more idiomatic clj.
I haven’t really tried the plugin/toolchain out yet.
But do you see any dealbreakers for running #scittle or #nbb ?
Or like you suggested in https://clojurians.slack.com/archives/C034FQN490E/p1665767911847449, maybe a custom SCI script with libs bundled?
I'm not familiar with Photoshop scripting but it sounds like scittle should work and else you could try making a custom SCI runtime
Btw there is also #cherry which is like #squint with with the CLJS data structures