Move boolean and float parsing to shared utils

This commit is contained in:
Bill Thornton 2021-09-02 08:39:58 -04:00
parent 5238888ecf
commit f32538ace4
5 changed files with 48 additions and 50 deletions

View file

@ -4,6 +4,7 @@
*/
import { Events } from 'jellyfin-apiclient';
import { toFloat } from '../../../../scripts/stringUtils';
import Settings from '../Settings';
import TimeSyncServer from './TimeSyncServer';
@ -26,7 +27,7 @@ class TimeSyncCore {
this.timeSyncServer = null;
this.timeSyncDeviceId = Settings.get('timeSyncDevice') || 'server';
this.extraTimeOffset = Settings.getFloat('extraTimeOffset', 0.0);
this.extraTimeOffset = toFloat(Settings.get('extraTimeOffset'), 0.0);
}
/**
@ -47,7 +48,7 @@ class TimeSyncCore {
});
Events.on(Settings, 'extraTimeOffset', () => {
this.extraTimeOffset = Settings.getFloat('extraTimeOffset', 0.0);
this.extraTimeOffset = toFloat(Settings.get('extraTimeOffset'), 0.0);
});
}