MWSE/public/studio/app.js

26 lines
821 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import MWSE from '/sdk/index.js';
import Studio from '/studio/Studio.js';
const loadingEl = document.getElementById('loading');
const loadingMsg = document.getElementById('loading-msg');
const appEl = document.getElementById('app');
const mwse = new MWSE(); // endpoint: otomatik — aynı sunucu
const studio = new Studio(mwse, appEl);
mwse.on('scope', async () => {
loadingEl.classList.add('hidden');
await studio.mount();
});
mwse.on('close', () => {
loadingMsg.textContent = 'Bağlantı kesildi — yeniden bağlanılıyor…';
loadingEl.classList.remove('hidden');
});
mwse.on('error', err => {
// Versiyon uyuşmazlığı veya hello timeout gibi hatalar burada görünür
loadingMsg.textContent = `Hata: ${err.message}`;
loadingEl.classList.remove('hidden');
});