Skip to content

Instantly share code, notes, and snippets.

@undavide
Last active March 14, 2018 21:48
Show Gist options
  • Save undavide/258a87a0359a3f9c9eb00f265a2df5e5 to your computer and use it in GitHub Desktop.
Save undavide/258a87a0359a3f9c9eb00f265a2df5e5 to your computer and use it in GitHub Desktop.
Passing a JSON string from the JSX back to the panel
// JS file (panel)
// ...
csInterface.evalScript('getDocumentInfo()', function(res) {
var resObj = JSON.parse(res);
// you have now access to the same docInfo object
});
// JSX file (Photoshop)
function getDocumentInfo() {
//... I just make up data here...
var docInfo = {
numberOfLayers : 4,
layerNames : ['Background', 'Curves 1', 'Retouch', 'Curves 2'],
colors : {
background : '#828282',
foreground : '#7d2555'
}
}
return JSON.stringify(docInfo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment