Close PS event - anyone know the name?

Trying to clear something when the PS application closes.

PhotoshopAction.addNotificationListener([“hostFocusChanged”], (event, descriptor) => {
console.log(event, JSON.stringify(descriptor, null, ’ '));
});

Recording the screen so I can quickly see the event firing on close seems to show this ‘hostfocusChanged’. However, this happens for more than just the application closing event.

Anyone know what event I can listen to for then the app is shutdown?

@kerrishotts

Do your thing on document close. Also you can check if there are no more documents open

1 Like

Literally just worked it round this way :smiley: Thanks for your help.

For information:
var PhotoshopAction = require(‘photoshop’).action;
PhotoshopAction.addNotificationListener([“close”], (event, descriptor) => {
console.log(event, JSON.stringify(descriptor, null, ’ '));
//check if any active document
if (!require(‘photoshop’).app.activeDocument)
//do your thing
});

1 Like