cleaning up processes when ExtensionUnloaded

Participant ,
Jun 13, 2021 Jun 13, 2021

Copy link to clipboard

Copied

Dear ppro fellows,

I'm trying to kill processes spawned by my CEP panel after the panel is closed.

As specialists from this forum explained, to register the ExtensionUnloaded event from my CEP panel I need to have the invisibale custom CEP panel which starts when ppro starts. 

Therefore:

Frist: in manifest.xml I added the second invisible extension and added to it:

<StartOn>
    <Event>applicationActivate</Event>
    <Event>com.adobe.csxs.events.ApplicationActivate</Event>
</StartOn>

And indeed, as far as I understand, this invisible panel starts when ppro starts.

Second:

in my index.js of  the invisible panel I'm listening for an 

com.adobe.csxs.events.ExtensionUnloaded

event:

csInterface.addEventListener("com.adobe.csxs.events.ExtensionUnloaded", function(){
alert("Closed app");
});

 But then, strange thing happens. When I start my ppro 

the "com.adobe.csxs.events.ExtensionUnloaded" is triggered somehow right on the start and I see this alert "Closed app".

Of course, when I close my visible CEP this alert is triggered again. But how can I get rid of this thing on the ppro start?

Is it because when ppro starts it unloads some panels and this alert is triggered by another unrelated to my extension event?

If so, is it possible to catch the unload event from my visible panel (with my ID) only?

Yaroslav.

 

 

 

 

 

TOPICS
SDK, User interface or workspaces

Views

235

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct Answers

Explorer , Jun 14, 2021 Jun 14, 2021
Check event data for information about what extension was unloaded.csInterface.addEventListener('com.adobe.csxs.events.ExtensionUnloaded', function(evt) { console.log(evt.data); });

Likes

Translate

Translate
Explorer , Jun 14, 2021 Jun 14, 2021
I don't know if I do it proper way, but I just check it like this:csInterface.addEventListener('com.adobe.csxs.events.ExtensionUnloaded', function(evt) { var extID = "your.extension.id"; if (evt.data.indexOf(extID) > -1) { // your code } });

Likes

Translate

Translate
Explorer ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Check event data for information about what extension was unloaded.

csInterface.addEventListener('com.adobe.csxs.events.ExtensionUnloaded', function(evt) {
  console.log(evt.data);
});

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Thanks, Ivan!

That did help and illuminated things.

As I found out evt.data return literally this:

<ExtensionUnloadedEvent>
	<Id>com.adobe.ccx.start</Id>
	<ClosingType>4</ClosingType>
</ExtensionUnloadedEvent>

This Id is not, of course,  the Id of my application.

So in the function of event Listener I need to add additional condition: check extention Id.

My last question is how do you get Id from event.data. I tried: 

evt.data.attrubutes'Id');
evt.data.attr('Id');
evt.data.getAttribute('Id');

Nothing worked.

Yaroslav.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

LATEST

I don't know if I do it proper way, but I just check it like this:

csInterface.addEventListener('com.adobe.csxs.events.ExtensionUnloaded', function(evt) {
  var extID = "your.extension.id";
  if (evt.data.indexOf(extID) > -1) {
    // your code
  }
});

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines