never make two app div
This commit is contained in:
parent
e0740f93d0
commit
dd5e493ab5
2 changed files with 19 additions and 10 deletions
|
@ -13,6 +13,7 @@
|
|||
|
||||
// ブロックの中に入れないと、定義した変数がブラウザのグローバルスコープに登録されてしまい邪魔なので
|
||||
(async () => {
|
||||
console.log('boot!')
|
||||
window.onerror = (e) => {
|
||||
renderError('SOMETHING_HAPPENED', e.toString());
|
||||
};
|
||||
|
@ -58,14 +59,11 @@
|
|||
? `?salt=${localStorage.getItem('salt')}`
|
||||
: '';
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.setAttribute('src', `/assets/${CLIENT_ENTRY}${salt}`);
|
||||
script.setAttribute('type', 'module');
|
||||
script.addEventListener('error', async () => {
|
||||
await checkUpdate();
|
||||
renderError('APP_FETCH_FAILED');
|
||||
});
|
||||
document.head.appendChild(script);
|
||||
import(`/assets/${CLIENT_ENTRY}${salt}`)
|
||||
.catch(async () => {
|
||||
await checkUpdate();
|
||||
renderError('APP_FETCH_FAILED');
|
||||
})
|
||||
//#endregion
|
||||
|
||||
//#region Theme
|
||||
|
|
|
@ -203,8 +203,19 @@ if (splash) splash.addEventListener('transitionend', () => {
|
|||
splash.remove();
|
||||
});
|
||||
|
||||
const rootEl = document.createElement('div');
|
||||
document.body.appendChild(rootEl);
|
||||
const rootEl = (() => {
|
||||
const MISSKEY_MOUNT_DIV_ID = 'misskey_app';
|
||||
|
||||
const currentEl = document.getElementById(MISSKEY_MOUNT_DIV_ID);
|
||||
|
||||
if (currentEl) return currentEl;
|
||||
|
||||
const rootEl = document.createElement('div');
|
||||
rootEl.id = MISSKEY_MOUNT_DIV_ID;
|
||||
document.body.appendChild(rootEl);
|
||||
return rootEl;
|
||||
})()
|
||||
|
||||
app.mount(rootEl);
|
||||
|
||||
// boot.jsのやつを解除
|
||||
|
|
Loading…
Reference in a new issue