Event when closing a window from the dock

Feature Description: Fire an event when the user clicks “close window” after right clicking on a window icon on the dock
Impact for my app: [low, mid, high, show-stopper]. Low
What is your current pain point? I want to be able to close my app when the user closes a particular window from the dock. But I also want to be able to sometimes close that window with out closing the whole app.
What do you have in mind to solve it? Either add a “method” feature to the onStateChanged event for a window. Or add a new event that fires when a user clicks the “Close window” menu option after right clicking on a dock icon.

note for stuff: after FR is accepted, add a link to the internal ticket.

The right way to implement this feature FMHO is to let your background controller (BC) handle open/closing windows. Your BC would be the first window to load when the app launches and the final window to close when the app is closed. The BC will decide if to exit the app when you close a particular window or close a specific window, without exit the app.