Improved boot.js with existing global window.rl

Put dev/Storage/Settings.js in boots.js global rl.settings
This commit is contained in:
djmaze 2020-09-04 12:05:17 +02:00
parent f90dbcc84b
commit aeb5275648
57 changed files with 284 additions and 380 deletions

View file

@ -4,8 +4,6 @@ import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { Layout, EditorDefaultType } from 'Common/Enums';
import { pInt } from 'Common/Utils';
import * as Settings from 'Storage/Settings';
class SettingsUserStore {
constructor() {
this.iAutoLogoutTimer = 0;
@ -52,21 +50,22 @@ class SettingsUserStore {
}
populate() {
this.layout(pInt(Settings.settingsGet('Layout')));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
const settingsGet = rl.settings.get;
this.layout(pInt(settingsGet('Layout')));
this.editorDefaultType(settingsGet('EditorDefaultType'));
this.autoLogout(pInt(Settings.settingsGet('AutoLogout')));
this.messagesPerPage(Settings.settingsGet('MPP'));
this.autoLogout(pInt(settingsGet('AutoLogout')));
this.messagesPerPage(settingsGet('MPP'));
this.showImages(!!Settings.settingsGet('ShowImages'));
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
this.allowDraftAutosave(!!Settings.settingsGet('AllowDraftAutosave'));
this.useThreads(!!Settings.settingsGet('UseThreads'));
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
this.showImages(!!settingsGet('ShowImages'));
this.useCheckboxesInList(!!settingsGet('UseCheckboxesInList'));
this.allowDraftAutosave(!!settingsGet('AllowDraftAutosave'));
this.useThreads(!!settingsGet('UseThreads'));
this.replySameFolder(!!settingsGet('ReplySameFolder'));
const refresh = () => {
clearTimeout(this.iAutoLogoutTimer);
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
if (0 < this.autoLogout() && !settingsGet('AccountSignMe')) {
this.iAutoLogoutTimer = setTimeout(() =>
dispatchEvent(new CustomEvent('rl.auto-logout'))
, this.autoLogout() * 60000);