Copy link to clipboard
Copied
I'm trying to build some kind of export tool in photoshop and i'm struggaling a bit. I'm trying to find the answer but i can't seem to find it. Is it possible to dispatch an event from the index.jsx(host) file and listen to it inside the index.js(client)?
I've found this but i need it the other way around.
Folder structure looks like this.
You could raise a CSXS event for this on the jsx end and then add eventhandler for this on the js end. Something like the following
//on the jsx end
var xLib = new ExternalObject("lib:\PlugPlugExternalObject");
if (xLib)
{
var eventObj = new CSXSEvent();
eventObj.type = "com.custom.event";
eventObj.data = "hello"
eventObj.dispatch();
}
//On the js end
var csInterface = new CSInterface();
csInterface.addEventListener("com.custom.event", function(event)
{
alert(event.data)
});
-Mana
...Copy link to clipboard
Copied
You could raise a CSXS event for this on the jsx end and then add eventhandler for this on the js end. Something like the following
//on the jsx end
var xLib = new ExternalObject("lib:\PlugPlugExternalObject");
if (xLib)
{
var eventObj = new CSXSEvent();
eventObj.type = "com.custom.event";
eventObj.data = "hello"
eventObj.dispatch();
}
//On the js end
var csInterface = new CSInterface();
csInterface.addEventListener("com.custom.event", function(event)
{
alert(event.data)
});
-Manan
Copy link to clipboard
Copied
Hi Manan,
Thanks! This is exactly what i need!!!!
Copy link to clipboard
Copied
I want to receive data back from CSXSEvent in MacOS. Are you have solution?
Thank you!
Copy link to clipboard
Copied
Hi @AnonID,
Events are one-way means of communication. If you need to send data from jsx to js then you can use the code snippet I wrote above. If you need to send data from js to jsx then you can do that directly by calling a method. Can you specify what exactly you are trying to do?
-Manan
Copy link to clipboard
Copied
I want to send data from jsx to js, and return data back from js to jsx in this function. In Mac, code in jsx execute done before code in dispatch event execute. Are you have solution for that? Can you check inbox of me?
Thank you!