How to do anything before logout?


#1

I want to do anything before user logout like record userId.


#2

Maybe you can hijack the Meteor.logout() method?

edit: Actually, you can pass a callback to Meteor.logout()


#3

Why not just write a new function that wrap Meteor.logout() ?


#4

It do every time when we refresh page (logout).
I want to do only one, when we click on logout link.


#5

What does your code look like for logout?


#6
Meteor.logout(function (error) {
   Events.track({
            type: 'Logout',
            userId: Meteor.userId()
        });
});

#7

Maybe you could set an event for the logout button?