diff --git a/public/migrate.html b/public/migrate.html index 0b746463..094a26cc 100644 --- a/public/migrate.html +++ b/public/migrate.html @@ -35,6 +35,12 @@ let dbReadyPromise = null; let name = 'keyval-store'; + let keys = [ + 'type-words-app-version', + 'typing-word-dict', + 'typing-word-setting', + 'typing-word-files' + ] function openDB(dbName, keys) { if (dbReadyPromise) return dbReadyPromise; @@ -59,7 +65,7 @@ return dbReadyPromise; } - openDB(name) + openDB(name, keys) // --- localStorage 读取 --- function readLocalStorageKeys(keys) { @@ -71,12 +77,7 @@ } // --- IndexedDB(兼容 idb-keyval)读取 --- - function readIndexedDBCompatible(dbName, keys = [ - 'type-words-app-version', - 'typing-word-dict', - 'typing-word-setting', - 'typing-word-files' - ]) { + function readIndexedDBCompatible(dbName, keys) { return new Promise(async (resolve) => { const db = await openDB(dbName, keys); const stores = Array.from(db.objectStoreNames); diff --git a/public/static-home.html b/public/static-home.html index 38c85a20..22d7049d 100644 --- a/public/static-home.html +++ b/public/static-home.html @@ -416,12 +416,10 @@ resolve(true); }); - iframe.onload = () => { - // iframe 加载完成,发送命令 - iframe.contentWindow.postMessage( - {type: "MIGRATE_REQUEST"}, - OLD_ORIGIN - ); + iframe.onload = function () { + setTimeout(()=>{ + iframe.contentWindow.postMessage({type: "REQUEST_MIGRATION_DATA"}, OLD_ORIGIN); + },3000) }; }); }