Watch
1
0
Fork
You've already forked Seyyed_arc
0
forked from hesabix/arc
Seyyed_arc/hesabixUI/hesabix_ui/web/flutter_bootstrap.js

37 lines
1.2 KiB
JavaScript

{{flutter_js}}
{{flutter_build_config}}
(function () {
function hesabixFlutterConfig() {
var cfg = window._flutterConfig || {};
return {
canvasKitBaseUrl: cfg.canvasKitBaseUrl || 'canvaskit/',
renderer: cfg.renderer || 'canvaskit',
useLocalCanvasKit: cfg.useLocalCanvasKit !== false,
fontFallbackBaseUrl: cfg.fontFallbackBaseUrl || (function () {
try {
return new URL('fonts/gstatic/s/', document.baseURI).href;
} catch (e) {
return 'fonts/gstatic/s/';
}
})()
};
}
async function hesabixStartFlutter() {
if (typeof window.__hesabixFlutterWebPreload === 'function') {
try {
await window.__hesabixFlutterWebPreload();
} catch (e) {
console.warn('[Hesabix] flutter_web_preload failed, falling back to direct load:', e);
}
}
// Do not register Flutter's deprecated service worker — it unregisters itself and
// reloads the page during activation, which races with CanvasKit initialization.
await _flutter.loader.load({ config: hesabixFlutterConfig() });
}
hesabixStartFlutter().catch(function (e) {
console.error('[Hesabix] Flutter bootstrap failed:', e);
});
})();