VulpesOS/gaia/apps/system/js/app.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

84 lines
2.9 KiB
JavaScript
Executable file

/* global BaseModule, LazyLoader, applications */
'use strict';
(function(exports) {
/**
* The entry point of the whole system app.
* It's duty is to prepare everything ready to launch
* the application core (core.js).
*
* Core could run without App, but it is expected to be slower
* because App will prepare the launch config for it with
* Launcher's help (launcher.js).
*
* In Launcher it will read the launch configurations and put
* some requests according to the config in the Service. When
* the relative modules which are started by Core is started,
* they could just fetch the launch config sychronously to
* fasten to launch progress.
*
* If Launcher does not prepare the value for them,
* the modules who are started by the Core will still get
* the values asynchronously.
*/
var App = function() {};
App.prototype = {
// TODO: decrease the files here and move them into specific loader
FILES: [
'js/wake_lock_manager.js',
'js/base_ui.js',
'js/base_icon.js',
'js/browser_config_helper.js',
'js/browser_frame.js',
'js/app_window.js',
'js/attention_window.js',
'js/system_dialog.js',
'js/core.js',
'js/launcher.js',
'js/settings_core.js',
'js/modal_dialog.js', // XXX: Wrap with ModalDialogService later
'shared/js/event_safety.js',
'shared/js/mobile_operator.js',
'shared/js/screen_layout.js',
'shared/js/settings_listener.js',
'shared/js/async_storage.js',
'shared/js/manifest_helper.js',
'shared/js/notification_helper.js',
'shared/js/sanitizer.js',
'shared/js/idletimer.js' // XXX: Move into ScreenManager
],
start: function() {
window.performance.mark('loadEnd');
return LazyLoader.load(this.FILES).then(() => {
return this.bootstrap();
});
},
bootstrap: function() {
if (this._booted) {
throw new Error('App: bootstrap should not be called twice.');
}
this._booted = true;
window.settingsCore = BaseModule.instantiate('SettingsCore');
window.settingsCore.start();
window.launcher = BaseModule.instantiate('Launcher');
return Promise.all([
// XXX:
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1161489
// Consider to move applications.start() into Core or AppCore
// but it may miss the mozChromeEvent to tell us application
// is ready to query.
applications.waitForReady(),
window.launcher.start()
]).then(() => {
window.core = BaseModule.instantiate('Core');
return window.core.start();
}).then(() => {
// To let integration test know we are ready to test.
document.body.setAttribute('ready-state', 'fullyLoaded');
window.performance.mark('fullyLoaded');
});
}
};
exports.App = App;
}(window));