On Window closed event?

0 favourites
  • 4 posts
  • Hi, i want to save the time when i close the game, i tried to do it with "On end of layout" and Browser`s "On suspended" but it isnt working. I feel that "On suspended" should be the correct way to do it, is it really?

    Please help, i need this to calculate the time away for mi iddle game.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So this is what the manual says:

    [quote:1gc3m6x4]On suspended

    On resumed

    Triggered when the page's visibility changes, or when a mobile app is going in to the background or foreground. When invisible or in the background the app is suspended: all events stop running and all audio is muted.

    So it wouldn't be triggered when closed. There is no on closed action, because browsers don't support it.

    However, what you can do is store the time in webstorage on every second. That way you know the time when the game was closed when opened.

  • Ok wow i never thought about that, i feel stupid now, i guess i was very frustrated to think clearly lol. Thanks for the help man! =D

  • No problem. It's not the most efficient solution but without a close event I'm not sure how else it could be done.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)