Skip to content

Commit

Permalink
fix: Unrelated localStorage changes would cause switch to light theme (
Browse files Browse the repository at this point in the history
  • Loading branch information
palant authored Jun 9, 2020
1 parent 9c7ea4f commit db102eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/js/dark-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ window.addEventListener("DOMContentLoaded", event => {
// https://codepen.io/tevko/pen/GgWYpg

window.addEventListener('storage', function (event) {
if (event.key !== 'theme') {
return;
}

if (event.newValue === 'dark') {
changeModeMeta('dark');
} else {
Expand Down

0 comments on commit db102eb

Please sign in to comment.