@@ -18,7 +18,8 @@ var checkAuth = false;
1818var profile = null ;
1919var lastLoginState = getLoginState ( ) ;
2020var lastUserId = getUserId ( ) ;
21- var loginStateChangeEvent = null ;
21+
22+ window . loginStateChangeEvent = null ;
2223
2324function resetCheckAuth ( ) {
2425 checkAuth = false ;
@@ -42,8 +43,7 @@ function setLoginState(bool, id) {
4243
4344function checkLoginStateChanged ( ) {
4445 if ( getLoginState ( ) != lastLoginState || getUserId ( ) != lastUserId ) {
45- if ( loginStateChangeEvent )
46- loginStateChangeEvent ( ) ;
46+ if ( loginStateChangeEvent ) setTimeout ( loginStateChangeEvent , 100 ) ;
4747 return true ;
4848 } else {
4949 return false ;
@@ -65,8 +65,7 @@ function clearLoginState() {
6565
6666function checkIfAuth ( yesCallback , noCallback ) {
6767 var cookieLoginState = getLoginState ( ) ;
68- if ( checkLoginStateChanged ( ) )
69- checkAuth = false ;
68+ if ( checkLoginStateChanged ( ) ) checkAuth = false ;
7069 if ( ! checkAuth || typeof cookieLoginState == 'undefined' ) {
7170 $ . get ( serverurl + '/me' )
7271 . done ( function ( data ) {
@@ -107,7 +106,6 @@ module.exports = {
107106 profile : profile ,
108107 lastLoginState : lastLoginState ,
109108 lastUserId : lastUserId ,
110- loginStateChangeEvent : loginStateChangeEvent ,
111109
112110 /* export functions */
113111 resetCheckAuth : resetCheckAuth ,
0 commit comments