diff --git a/js/init.js b/js/init.js index 7fca961..2368075 100644 --- a/js/init.js +++ b/js/init.js @@ -6,9 +6,18 @@ function constructStorageKey() { function syncState() { let storageKey = constructStorageKey(); - chrome.storage.sync.get(storageKey, function(result) { + chrome.storage.sync.get(storageKey, function onChromeStorageSyncResult(result) { let board = document.getElementById('board'); + if (board === null) { + window.addEventListener( + 'domcontentloaded', + onChromeStorageSyncResult.bind(this, result) + ); + + return; + } + if (result[storageKey]) { board.classList.add(result[storageKey]); }