Skip to content

Commit 47bc74a

Browse files
committed
More samples
1 parent d6fa286 commit 47bc74a

File tree

18 files changed

+196
-80
lines changed

18 files changed

+196
-80
lines changed

cross-compatible-js-sample/src/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import "./index.css";
22

33
import { entrypoints, host, versions } from "uxp";
44

5-
const APP_TYPE = host?.name === "Photoshop" ? "Photoshop" : "XD"; //Currently a bug with host being undefined in XD, fixed in UXP 5.3 (XD 43)
6-
75
entrypoints.setup({
86
commands: {
97
about: {
@@ -50,7 +48,7 @@ window.addEventListener("load", () => {
5048
function showAbout() {
5149
const uxpVersion = versions.uxp.split("-")[1];
5250

53-
if (APP_TYPE === "Photoshop") {
51+
if (host.name === "Photoshop") {
5452
const app = require("photoshop").app;
5553

5654
app.showAlert(`Cross-Compatible JS Sample\n\nApp: ${host.name}\nVersion: ${host.version}\nUXP: ${uxpVersion}`);
@@ -67,7 +65,7 @@ function createLabel(e) {
6765

6866
if (textArea.value.length === 0) {
6967
textArea.invalid = true;
70-
} else if (APP_TYPE === "Photoshop") {
68+
} else if (host.name === "Photoshop") {
7169
const { batchPlay } = require("photoshop").action;
7270
const { executeAsModal } = require("photoshop").core;
7371

@@ -122,7 +120,7 @@ function createLabel(e) {
122120
commandName: "Create Label"
123121
});
124122

125-
} else if (APP_TYPE === "XD") {
123+
} else if (host.name === "XD") {
126124
const { Text, Color } = require("scenegraph");
127125
const { editDocument } = require("application");
128126

hello-world-js-sample/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.
-1.23 KB
Binary file not shown.
-1.12 KB
Binary file not shown.

hello-world-js-sample/index.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

hello-world-js-sample/manifest.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

hello-world-js-sample/package.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

vanilla-js-sample/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
File renamed without changes.
452 Bytes
Loading

0 commit comments

Comments
 (0)