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