1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 12:55:14 +03:00

feat: migrate landing to modules

This commit is contained in:
Tomas Chmelevskij 2021-03-01 20:05:44 +01:00
parent 68b39643b7
commit d8be3dd5a2
3 changed files with 23 additions and 25 deletions

View file

@ -1,8 +1,5 @@
import { i18n } from './localization';
window.googleAnalytics = analytics;
window.analytics = null;
$(document).ready(function () {
useGlobalNodeFunctions();
@ -40,7 +37,6 @@ function appReady() {
});
});
}
window.appReady = appReady;
function checkSetupAnalytics(callback) {
if (!analytics) {
@ -58,8 +54,6 @@ function checkSetupAnalytics(callback) {
}
}
window.checkSetupAnalytics = checkSetupAnalytics;
function getBuildType() {
return GUI.Mode;
}
@ -301,7 +295,7 @@ function startProcess() {
switch (tab) {
case 'landing':
TABS.landing.initialize(content_ready);
import('./tabs/landing').then(({ landing }) => landing.initialize(content_ready));
break;
case 'changelog':
TABS.staticTab.initialize('changelog', content_ready);
@ -548,7 +542,6 @@ function setDarkTheme(enabled) {
});
}
window.setDarkTheme = setDarkTheme;
function checkForConfiguratorUpdates() {
const releaseChecker = new ReleaseChecker('configurator', 'https://api.github.com/repos/betaflight/betaflight-configurator/releases');
@ -556,8 +549,6 @@ function checkForConfiguratorUpdates() {
releaseChecker.loadReleaseData(notifyOutdatedVersion);
}
window.checkForConfiguratorUpdates = checkForConfiguratorUpdates;
function notifyOutdatedVersion(releaseData) {
ConfigStorage.get('checkForConfiguratorUnstableVersions', function (result) {
let showUnstableReleases = false;
@ -611,8 +602,6 @@ function isExpertModeEnabled() {
return $('input[name="expertModeCheckbox"]').is(':checked');
}
window.isExpertModeEnabled = isExpertModeEnabled;
function updateTabList(features) {
if (isExpertModeEnabled()) {
@ -667,8 +656,6 @@ function updateTabList(features) {
}
window.updateTabList = updateTabList;
function zeroPad(value, width) {
let valuePadded = String(value);
@ -700,8 +687,6 @@ function generateFilename(prefix, suffix) {
return `${filename}.${suffix}`;
}
window.generateFilename = generateFilename;
function showErrorDialog(message) {
const dialog = $('.dialogError')[0];
@ -714,8 +699,6 @@ function showErrorDialog(message) {
dialog.showModal();
}
window.showErrorDialog = showErrorDialog;
function showDialogDynFiltersChange() {
const dialogDynFiltersChange = $('.dialogDynFiltersChange')[0];
@ -728,4 +711,16 @@ function showDialogDynFiltersChange() {
}
}
// TODO: all of these are used as globals in other parts.
// once moved to modules extract to own module.
window.showDialogDynFiltersChange = showDialogDynFiltersChange;
window.googleAnalytics = analytics;
window.analytics = null;
window.showErrorDialog = showErrorDialog;
window.generateFilename = generateFilename;
window.updateTabList = updateTabList;
window.isExpertModeEnabled = isExpertModeEnabled;
window.checkForConfiguratorUpdates = checkForConfiguratorUpdates;
window.setDarkTheme = setDarkTheme;
window.appReady = appReady;
window.checkSetupAnalytics = checkSetupAnalytics;