[CmdSwitches] Simplify source a bit

This commit is contained in:
Ducko 2022-03-15 17:34:57 +00:00
parent 030fc2a044
commit 49dbd48a05

View file

@ -6,7 +6,9 @@ const presets = {
'battery': '--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu' // Known to have better battery life for Chromium? 'battery': '--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu' // Known to have better battery life for Chromium?
}; };
const combinePresets = (...keys) => Object.values(keys.reduce((acc, x) => {
module.exports = () => {
for (const [ key, ...values ] of Object.values([ 'base', ...(oaConfig.cmdPreset || 'perf').split(',') ].reduce((acc, x) => {
for (const cmd of (presets[x] || '').split(' ')) { for (const cmd of (presets[x] || '').split(' ')) {
if (!cmd) continue; if (!cmd) continue;
@ -17,11 +19,7 @@ const combinePresets = (...keys) => Object.values(keys.reduce((acc, x) => {
} }
return acc; return acc;
}, {})); }, {}))) {
module.exports = () => {
for (const [ key, ...values ] of combinePresets('base', ...(oaConfig.cmdPreset || 'perf').split(','))) {
app.commandLine.appendSwitch(key.replace('--', ''), values.join(',')); app.commandLine.appendSwitch(key.replace('--', ''), values.join(','));
} }
} };