Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Moran 285 posts 934 karma points
    Oct 19, 2020 @ 05:41
    Moran
    0

    Session timeout message

    Hi i am trying to create an event listener for the user's timeout event. I read the guide here. Do I need to put the file events.service.js in my code? If yes, How can I do this?

    Second question: Do I build the event listener the same way as I build a Property Editor? Thanks

  • Joep 96 posts 698 karma points
    Oct 20, 2020 @ 11:37
    Joep
    100

    Hi,

    What you can do is the following:

    1. Create a new folder in App_Plugins called 'CustomTimeoutMessage'
    2. Create a js file (for example custom.timeout.service.js)

          angular.module("umbraco").run(function(eventsService){    
           //Add the eventlistener here )};
      
    3. Then to make sure this runs when umbraco loads, create a package.manifest

    { "javascript": [ "~/App_Plugins/CustomTimeoutMessage/custom.timeout.service.js" ] }

    Let me know how it goes!

    (sorry for the code snippets, I never get this to show right ;) )

    -Joep

  • Moran 285 posts 934 karma points
    Oct 21, 2020 @ 11:28
    Moran
    0

    Works great, Thank you Can you tell me what is the right way to unsubscribe the listener? or does it happen automatically when the user log out?

  • Joep 96 posts 698 karma points
    Oct 21, 2020 @ 11:43
    Joep
    0

    The eventlistener only gets initialized once I think. So when Umbraco boots , it runs your JS once.

  • Moran 285 posts 934 karma points
    Oct 21, 2020 @ 12:19
    Moran
    0

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft