Last active
April 3, 2018 19:54
-
-
Save undavide/2e4f66eae6e85596479207d49ef541bc to your computer and use it in GitHub Desktop.
Send a JSON obiect as a parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JS file (panel) | |
var paramObj = { | |
sharpeningStrength : 225, | |
protection : { | |
highlights : 50, | |
midtones : 15, | |
shadows : 0, | |
}, | |
oldAlgorithm : false, | |
copyrightString : "© Jane Doe 2018" | |
}; | |
var paramString = JSON.stringify(paramObj); | |
csInterface.evalScript('addSharpeningForWeb(' + paramString + ')'); | |
// JSX file (Photoshop) | |
function addSharpeningForWeb(paramObj) { | |
// ... you can directly access everything here: | |
// no need to JSON.parse() | |
var sharpeningStrength = paramObj.sharpeningStrength; | |
var highlightsProtection = paramObj.protection.highlights; | |
// etc. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment