This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-01
Channels
- # aws (37)
- # babashka (7)
- # babashka-sci-dev (2)
- # beginners (75)
- # biff (7)
- # calva (85)
- # cider (9)
- # clj-kondo (26)
- # clj-yaml (1)
- # clojure (45)
- # clojure-europe (4)
- # clojure-norway (1)
- # clojure-spec (3)
- # clojure-uk (2)
- # clojurescript (3)
- # core-typed (2)
- # cursive (12)
- # fulcro (3)
- # humbleui (5)
- # jobs (8)
- # malli (1)
- # meander (3)
- # membrane (1)
- # portal (50)
- # squint (15)
- # vim (1)
Any way to compile this from squint?
require('photoshop').core.showAlert('Hello world')
I tried this, but it doesn’t work.
(ns test
(:require ["photoshop" :as app]))
(app/core.showAlert "Hello world")
This is to script https://developer.adobe.com/photoshop/uxp/2022/ps_reference/, which they say uses V8 JavaScript engine, which supports ES6
(..so maybe can use Cherry instead, or even NBB in a photoshop plugin…?)
Unfortunately I think you need a Photoshop/CC install to run/test.When i run the js code, I get an alert popup.
When I run the squint js, nothing happens.
The squint js uses import
instead of require
, not sure if thats an issue.
I might just have the cljs .
syntax wrong…
Here is the output
import { core.showAlert as app_core.showAlert } from 'photoshop'
app_core.showAlert("Hello world");
Here is my latest try
(ns test)
(def ps (require '"photoshop"))
(.. js/ps.core (showAlert "Hello"))
Compiles to:
var ps = require("photoshop")
ps;
ps.core.showAlert("Hello");
export { ps }
And it works!!!.. if I remove export { ps }
at the end.
Any way to omit that from output?using (:require)
doesn’t seem to work
(ns test
(:require ["photoshop" :as ps]))
(. ps/core (showAlert "Hello"))
import { core as ps_core } from 'photoshop'
ps_core.showAlert("Hello");
Maybe Photoshop doesn’t like import
I think I am struggling with how to properly call functions from modules from this "photoshop"
api root.
like what is the equivalent of this?
var PhotoshopCore = require('photoshop').core;
Ok so require("photoshop")["core"]
is equivalent to require('photoshop').core
?
Thanks!
@U09D96P9B I published a new version of squint where you can pass --elide-exports
on the command line
$ ./node_cli.js compile --help
Usage: squint compile <files> <opts>
Options:
--elide-imports: do not include imports
--elide-exports: do not include exports
Awesome! Thanks for following up on that.