Skip to main content
Inspiring
June 14, 2021
Answered

cleaning up processes when ExtensionUnloaded

  • June 14, 2021
  • 1 reply
  • 1130 views

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.

 

 

 

 

 

This topic has been closed for replies.
Correct answer Ivan Stepanov

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
  }
});

1 reply

Ivan Stepanov
Legend
June 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);
});

 

Inspiring
June 14, 2021

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.

 

Ivan Stepanov
Ivan StepanovCorrect answer
Legend
June 15, 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
  }
});