1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00
inav-configurator/js/programmingPidCollection.js
Pawel Spychalski (DzikuVx) f320aa4f02 Show PID output in GUI
2021-04-05 16:06:03 +02:00

58 lines
No EOL
1.1 KiB
JavaScript

'use strict';
let ProgrammingPidCollection = function () {
let self = {},
data = [],
$container;
self.put = function (element) {
data.push(element);
};
self.get = function () {
return data;
};
self.flush = function () {
data = [];
};
self.getCount = function () {
return data.length
};
self.open = function () {
self.render();
$container.show();
};
self.init = function ($element) {
$container = $element;
};
self.render = function () {
let $table = $container.find(".pid__table")
$table.find("tbody tr").remove();
for (let k in self.get()) {
if (self.get().hasOwnProperty(k)) {
self.get()[k].render(k, $table);
}
}
GUI.switchery();
};
self.update = function(statuses) {
let $table = $container.find(".pid__table")
for (let k in self.get()) {
if (self.get().hasOwnProperty(k)) {
self.get()[k].update(k, statuses.get(k), $table);
}
}
}
return self;
};