Files

23 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpgradeScripts = void 0;
/* 0.1.5: connections created before a setting existed have no value for it. Companion's
form shows such a number as 0 -- below the field's minimum -- and then refuses to save
any change to the connection. Fill each missing setting with its default, once. */
const DEFAULTS = { playerPollMs: 1000, positionTrimMs: 0, cuePollMs: 5000, listPollMs: 120000 };
function fillMissingDefaults(_context, props) {
const config = props.config;
let changed = false;
if (config) {
for (const [key, value] of Object.entries(DEFAULTS)) {
if (config[key] === undefined || config[key] === null || config[key] === '') {
config[key] = value;
changed = true;
}
}
}
return { updatedConfig: changed ? config : null, updatedActions: [], updatedFeedbacks: [] };
}
exports.UpgradeScripts = [fillMissingDefaults];
//# sourceMappingURL=upgrades.js.map