Forum - Run code on window close
- This topic has 4 replies, 2 voices, and was last updated 9 months, 1 week ago by Ori Miller.
- AuthorPosts
- March 17, 2022 at 4:50 pm #72931Thomas VentimigliaParticipant
Hello,
How do I run some code when my Cloud App window is closed? I want to display a modal dialog when the user attempts to close the app, then, once closed, refresh the record in the Alma window using this.eventsService.refreshPage(). I tried putting the code in ngOnDestroy but nothing is happening.
Thanks!
Tom
April 27, 2022 at 6:05 pm #73038Thomas VentimigliaParticipantJust wanted to touch this thread as it has not received any replies. Basically, what I want to do is prompt the user to save if they try to close the app with unsaved work. This seems like a basic feature, but I cannot find any way to trigger a dialog to appear on closing the app. ngDestroy doesn’t seem to be the answer. Can anyone suggest a way? Thanks.
April 28, 2022 at 11:26 am #73043Ori MillerKeymasterHi Tom,
I’m afraid we don’t have something to suggest at this point. The app has no control over whether the window closes or not.
Perhaps in the future we’ll add an API for that.
I hope you’ll be able to work without it,
Ori
Alma Dev.June 14, 2022 at 6:15 pm #73328Thomas VentimigliaParticipantJust to clarify, I shouldn’t have used the word “window”. I am referring to a case where the user closes the app, but not the browser window (i.e. the user returns to Alma from the app). Does this generate any event that the app can act on? In some browsers, simply resizing the browser window will close the Cloud App, which can result in lost work if the user is not given the chance to save their work first. Thanks for your help.
Tom
June 15, 2022 at 5:41 am #73329Ori MillerKeymasterHi Tom,
Thanks for your clarification, but this was my understanding as well. It is indeed useful as you describe, but unfortunately, I can’t say at this point when will we have support for such “API”.
Thank you for your patience,
Ori - AuthorPosts
- You must be logged in to reply to this topic.