Forum - Run code on window close

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #72931
    Thomas Ventimiglia
    Participant

    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

    #73038
    Thomas Ventimiglia
    Participant

    Just 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.

    #73043
    Ori Miller
    Keymaster

    Hi 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.

    #73328
    Thomas Ventimiglia
    Participant

    Just 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

    #73329
    Ori Miller
    Keymaster

    Hi 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.