From b0b5253f66f5ba6e031f5a88dc1bef613517b3b6 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 26 Jan 2017 23:26:20 +0100 Subject: Refactor remaining codebase to use 'const' --- src/scripts/user.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/scripts/user.ts') diff --git a/src/scripts/user.ts b/src/scripts/user.ts index dda2dcab..7b157603 100644 --- a/src/scripts/user.ts +++ b/src/scripts/user.ts @@ -36,7 +36,7 @@ window["gapiSigninButton"] = () => { gapi.signin2.render('google-signin', { 'scope': 'profile email', 'onsuccess': (googleUser) => { - let auth2 = gapi.auth2.getAuthInstance(); + const auth2 = gapi.auth2.getAuthInstance(); // Handle signout click $("nav .user .sign-out").click(() => { @@ -47,12 +47,12 @@ window["gapiSigninButton"] = () => { }); // Check if the token has expired - let currentTime = (new Date()).getTime() / 1000; + const currentTime = (new Date()).getTime() / 1000; if (parseInt(localStorage.getItem("googleTokenExpiration")) - currentTime <= 0) { auth2.signIn().then(() => { localStorage.setItem("googleToken", googleUser.getAuthResponse().id_token); - let expirationTime = (new Date()).getTime() / 1000 + parseInt(googleUser.getAuthResponse().expires_in) - 5; + const expirationTime = (new Date()).getTime() / 1000 + parseInt(googleUser.getAuthResponse().expires_in) - 5; localStorage.setItem("googleTokenExpiration", expirationTime.toString()); }); } @@ -73,4 +73,4 @@ export function removeUserInfo() { localStorage.removeItem("googleEmail"); localStorage.removeItem("userId"); localStorage.removeItem("simulationId"); -} \ No newline at end of file +} -- cgit v1.2.3 From bf6df85449fa3f2df98fabefed9d7e46be066c42 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 27 Jan 2017 09:40:41 +0100 Subject: Implement incremental TS compilation for watching --- src/scripts/user.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/scripts/user.ts') diff --git a/src/scripts/user.ts b/src/scripts/user.ts index 7b157603..66e44b21 100644 --- a/src/scripts/user.ts +++ b/src/scripts/user.ts @@ -30,7 +30,7 @@ window["___gcfg"] = { }; /** - * Google signin button + * Google signin button. */ window["gapiSigninButton"] = () => { gapi.signin2.render('google-signin', { @@ -65,8 +65,10 @@ window["gapiSigninButton"] = () => { }; +/** + * Removes session storage items. + */ export function removeUserInfo() { - // Remove session storage items localStorage.removeItem("googleToken"); localStorage.removeItem("googleTokenExpiration"); localStorage.removeItem("googleName"); -- cgit v1.2.3