How to tell when a View was closed/removed?


#1

I’m writing a package (script-runner) which run scripts for the user. When the output window is closed, I want to terminate the script. What is the best way to achieve this?

My view is a subclass of ScrollView but I’m not sure how or what event I should be using to terminate the script if the window is closed.

Does anyone have any suggestions?


#2

I don’t know, but have you tried setting a few breakpoints on event listeners in the Dev Tools’ Services tab, when you close the view?


#3

No, I haven’t tried the event listeners thing. I will give it a go. I don’t think this should be so complicated :frowning:


#4

Have you tried putting the logic in the deactivate method? This is called as part of view cleanup, to my knowledge …