chore(plugin): align startup principle with appready/listener manifest-safe init
This commit is contained in:
@@ -240,6 +240,9 @@
|
|||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
try {
|
try {
|
||||||
|
// Принцип как у surs.js: запуск после готовности приложения + ветка по версии Lampa
|
||||||
|
var appDigital = (window.Lampa && Lampa.Manifest && Lampa.Manifest.app_digital) ? Number(Lampa.Manifest.app_digital) : 0;
|
||||||
|
log('Lampa app_digital=' + appDigital);
|
||||||
mountUi();
|
mountUi();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Start error: ' + (e && e.message ? e.message : e));
|
log('Start error: ' + (e && e.message ? e.message : e));
|
||||||
@@ -253,6 +256,9 @@
|
|||||||
if (e && e.type === 'ready') start();
|
if (e && e.type === 'ready') start();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
window.addEventListener('load', start);
|
// fallback, чтобы не падать в старых оболочках
|
||||||
|
window.addEventListener('load', function () {
|
||||||
|
setTimeout(start, 300);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user