Account.loggedInChanged()


#1

Hello,
How do I properly check for this event in my code?
I need it to fire off each time the user logs in and out…

I did this but it does not work,I get an error:

var loggedIn = Account.loggedInChanged();
if (loggedIn) {
    print("loggedIN: ");
} else {
    print("not LoggedIN: ");
}

#2

Account.loggedIn is a read-only JavaScript property that tells you whether you’re logged in or not.

Account.loggedInChanged is a signal which tells you when the Account.loggedIn value has changed…

Account.loggedInChanged.connect(function (loggedIn) {
    print("Logged in: " + loggedIn);
    print("Logged in: " + Account.loggedIn);  // Should be the same as previous line.
});

#3

Awesome. Thank you for explaining that. Make more sense now :blush: