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

move tabs to use esm modules

This commit is contained in:
Tomas Chmelevskij 2022-04-14 22:51:42 +02:00
parent b7d1ec0837
commit 5a74094df1
25 changed files with 350 additions and 218 deletions

View file

@ -1,12 +1,12 @@
'use strict';
import { i18n } from "../localization";
TABS.receiver = {
const receiver = {
rateChartHeight: 117,
analyticsChanges: {},
needReboot: false,
};
TABS.receiver.initialize = function (callback) {
receiver.initialize = function (callback) {
const tab = this;
if (GUI.active_tab !== 'receiver') {
@ -806,11 +806,11 @@ TABS.receiver.initialize = function (callback) {
}
};
TABS.receiver.getReceiverData = function () {
receiver.getReceiverData = function () {
MSP.send_message(MSPCodes.MSP_RC, false, false);
};
TABS.receiver.initModelPreview = function () {
receiver.initModelPreview = function () {
this.keepRendering = true;
this.model = new Model($('.model_preview'), $('.model_preview canvas'));
@ -828,7 +828,7 @@ TABS.receiver.initModelPreview = function () {
$(window).on('resize', $.bind(this.model.resize, this.model));
};
TABS.receiver.renderModel = function () {
receiver.renderModel = function () {
if (this.keepRendering) { requestAnimationFrame(this.renderModel.bind(this)); }
if (!this.clock) { this.clock = new THREE.Clock(); }
@ -847,7 +847,7 @@ TABS.receiver.renderModel = function () {
}
};
TABS.receiver.cleanup = function (callback) {
receiver.cleanup = function (callback) {
$(window).off('resize', this.resize);
if (this.model) {
$(window).off('resize', $.proxy(this.model.resize, this.model));
@ -859,7 +859,7 @@ TABS.receiver.cleanup = function (callback) {
if (callback) callback();
};
TABS.receiver.refresh = function (callback) {
receiver.refresh = function (callback) {
const self = this;
GUI.tab_switch_cleanup(function () {
@ -871,7 +871,7 @@ TABS.receiver.refresh = function (callback) {
});
};
TABS.receiver.updateRcInterpolationParameters = function () {
receiver.updateRcInterpolationParameters = function () {
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
if ($('select[name="rcInterpolation-select"]').val() === '3') {
$('.tab-receiver .rc-interpolation-manual').show();
@ -935,3 +935,8 @@ function updateInterpolationView() {
$('.tab-receiver .rcSmoothing-setpoint-cutoff').hide();
}
}
window.TABS.receiver = receiver;
export {
receiver,
};