mirror of https://github.com/keeweb/keeweb.git
removed app-model prepare
This commit is contained in:
parent
52741cf46a
commit
ffdc438091
|
@ -25,6 +25,8 @@ import { KdbxwebInit } from 'util/kdbxweb/kdbxweb-init';
|
|||
import { Locale } from 'util/locale';
|
||||
import { AppView } from 'views/app-view';
|
||||
import 'hbs-helpers';
|
||||
import { AutoType } from './auto-type';
|
||||
import { Storage } from './storage';
|
||||
|
||||
StartProfiler.milestone('loading modules');
|
||||
|
||||
|
@ -41,6 +43,7 @@ ready(() => {
|
|||
.then(initModules)
|
||||
.then(loadRemoteConfig)
|
||||
.then(ensureCanRun)
|
||||
.then(initStorage)
|
||||
.then(showApp)
|
||||
.then(postInit)
|
||||
.catch(e => {
|
||||
|
@ -87,6 +90,7 @@ ready(() => {
|
|||
PopupNotifier.init();
|
||||
KdbxwebInit.init();
|
||||
FocusDetector.init();
|
||||
AutoType.init();
|
||||
window.kw = ExportApi;
|
||||
return PluginManager.init().then(() => {
|
||||
StartProfiler.milestone('initializing modules');
|
||||
|
@ -128,6 +132,13 @@ ready(() => {
|
|||
});
|
||||
}
|
||||
|
||||
function initStorage() {
|
||||
for (const prv of Object.values(Storage)) {
|
||||
prv.init();
|
||||
}
|
||||
StartProfiler.milestone('initializing storage');
|
||||
}
|
||||
|
||||
function showApp() {
|
||||
return Promise.resolve().then(() => {
|
||||
const skipHttpsWarning =
|
||||
|
@ -169,9 +180,6 @@ ready(() => {
|
|||
}
|
||||
|
||||
function showView() {
|
||||
appModel.prepare();
|
||||
StartProfiler.milestone('preparing app model');
|
||||
|
||||
new AppView(appModel).render();
|
||||
StartProfiler.milestone('first view rendering');
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import { Launcher } from 'comp/launcher';
|
|||
import { Alerts } from 'comp/ui/alerts';
|
||||
import { Timeouts } from 'const/timeouts';
|
||||
import { AppSettingsModel } from 'models/app-settings-model';
|
||||
import { AppModel } from 'models/app-model';
|
||||
import { Locale } from 'util/locale';
|
||||
import { Logger } from 'util/logger';
|
||||
import { AutoTypeSelectView } from 'views/auto-type/auto-type-select-view';
|
||||
|
@ -20,11 +21,10 @@ const AutoType = {
|
|||
pendingEvent: null,
|
||||
running: false,
|
||||
|
||||
init(appModel) {
|
||||
init() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
this.appModel = appModel;
|
||||
Events.on('auto-type', e => this.handleEvent(e));
|
||||
Events.on('main-window-blur', e => this.resetPendingEvent(e));
|
||||
Events.on('main-window-will-close', e => this.resetPendingEvent(e));
|
||||
|
@ -206,9 +206,9 @@ const AutoType = {
|
|||
|
||||
selectEntryAndRun() {
|
||||
this.getActiveWindowInfo((e, windowInfo) => {
|
||||
const filter = new AutoTypeFilter(windowInfo, this.appModel);
|
||||
const filter = new AutoTypeFilter(windowInfo, AppModel.instance);
|
||||
const evt = { filter, windowInfo };
|
||||
if (!this.appModel.files.hasOpenFiles()) {
|
||||
if (!AppModel.instance.files.hasOpenFiles()) {
|
||||
this.pendingEvent = evt;
|
||||
logger.debug('auto-type event delayed');
|
||||
this.focusMainWindow();
|
||||
|
|
|
@ -47,14 +47,7 @@ class AppModel {
|
|||
Events.on('unset-keyfile', this.unsetKeyFile.bind(this));
|
||||
|
||||
this.appLogger = new Logger('app');
|
||||
AppModel.instance = this; // For KeeWebHttp. TODO: kill this
|
||||
}
|
||||
|
||||
prepare() {
|
||||
AutoType.init(this);
|
||||
for (const prv of Object.values(Storage)) {
|
||||
prv.init();
|
||||
}
|
||||
AppModel.instance = this;
|
||||
}
|
||||
|
||||
loadConfig(configLocation) {
|
||||
|
|
Loading…
Reference in New Issue