-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from CBIIT/mvp-2
Sync MVP-2.0.0 (M2) into MVP-2.1.0 (M3)
- Loading branch information
Showing
16 changed files
with
291 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/* eslint-disable */ | ||
window.injectedEnv = { | ||
NIH_AUTHORIZE_URL: '', | ||
NIH_CLIENT_ID: '', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const sessionStorageTransfer = (event) => { | ||
let $event = event; | ||
if (!$event) { | ||
$event = window.event; | ||
} // ie suq | ||
if (!$event.newValue) return; // do nothing if no value to work with | ||
if ($event.key === 'getSessionStorage') { | ||
// another tab asked for the sessionStorage -> send it | ||
localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)); | ||
// the other tab should now have it, so we're done with it. | ||
localStorage.removeItem('sessionStorage'); // <- could do short timeout as well. | ||
} else if ($event.key === 'sessionStorage' && !sessionStorage.length) { | ||
// another tab sent data <- get it | ||
const data = JSON.parse($event.newValue); | ||
Object.keys(data).forEach((key) => { | ||
sessionStorage.setItem(key, data[key]); | ||
}); | ||
} else if ($event.key === 'logout') { | ||
sessionStorage.clear(); | ||
} | ||
}; | ||
|
||
// listen for changes to localStorage | ||
if (window.addEventListener) { | ||
window.addEventListener('storage', sessionStorageTransfer, false); | ||
} else { | ||
window.addEventListener('onstorage', sessionStorageTransfer); | ||
} | ||
|
||
// Ask other tabs for session storage (this is ONLY to trigger 'storage' event) | ||
if (!sessionStorage.length) { | ||
localStorage.setItem('getSessionStorage', 'true'); | ||
localStorage.removeItem('getSessionStorage'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.