mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 15:25:51 +01:00
open window before loading becca
This commit is contained in:
@@ -13,16 +13,20 @@ const EtapiToken = require("./entities/etapi_token");
|
||||
const cls = require("../services/cls");
|
||||
const entityConstructor = require("../becca/entity_constructor");
|
||||
|
||||
let setBeccaAsLoaded = null;
|
||||
|
||||
const beccaLoaded = new Promise((res, rej) => {
|
||||
sqlInit.dbReady.then(() => {
|
||||
load();
|
||||
|
||||
cls.init(() => require('../services/options_init').initStartupOptions());
|
||||
|
||||
res();
|
||||
});
|
||||
setBeccaAsLoaded = res;
|
||||
});
|
||||
|
||||
function loadInitially() {
|
||||
load();
|
||||
|
||||
cls.init(() => require('../services/options_init').initStartupOptions());
|
||||
|
||||
setBeccaAsLoaded();
|
||||
}
|
||||
|
||||
function load() {
|
||||
const start = Date.now();
|
||||
becca.reset();
|
||||
@@ -245,5 +249,6 @@ eventService.subscribeBeccaLoader(eventService.LEAVE_PROTECTED_SESSION, load);
|
||||
module.exports = {
|
||||
load,
|
||||
reload,
|
||||
beccaLoaded
|
||||
beccaLoaded,
|
||||
loadInitially
|
||||
};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const becca = require('./becca.js');
|
||||
const becca = require('./becca');
|
||||
const cls = require('../services/cls');
|
||||
const protectedSessionService = require('../services/protected_session');
|
||||
const log = require('../services/log');
|
||||
|
||||
function isNotePathArchived(notePath) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const scriptService = require('./script');
|
||||
const cls = require('./cls');
|
||||
const sqlInit = require('./sql_init');
|
||||
const config = require('./config');
|
||||
const log = require('./log');
|
||||
const sql = require("./sql");
|
||||
const becca = require("../becca/becca");
|
||||
const specialNotesService = require("../services/special_notes");
|
||||
const protectedSessionService = require("../services/protected_session");
|
||||
const beccaLoader = require("../becca/becca_loader");
|
||||
|
||||
function getRunAtHours(note) {
|
||||
try {
|
||||
@@ -50,7 +50,7 @@ function runNotesWithLabel(runAttrValue) {
|
||||
}
|
||||
}
|
||||
|
||||
sqlInit.dbReady.then(() => {
|
||||
beccaLoader.beccaLoaded.then(() => {
|
||||
if (!process.env.TRILIUM_SAFE_MODE) {
|
||||
cls.init(() => specialNotesService.createMissingSpecialNotes());
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ const becca = require('../../../becca/becca');
|
||||
const beccaService = require('../../../becca/becca_service');
|
||||
const utils = require('../../utils');
|
||||
const log = require('../../log');
|
||||
const scriptService = require("../../script.js");
|
||||
|
||||
function searchFromNote(note) {
|
||||
let searchResultNoteIds, highlightedTokens;
|
||||
@@ -69,6 +68,7 @@ function searchFromRelation(note, relationName) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const scriptService = require("../../script");
|
||||
const result = scriptService.executeNote(scriptNote, { originEntity: note });
|
||||
|
||||
if (!Array.isArray(result)) {
|
||||
|
||||
@@ -44,11 +44,11 @@ ipcMain.on('create-extra-window', (event, arg) => {
|
||||
createExtraWindow(arg.notePath, arg.hoistedNoteId);
|
||||
});
|
||||
|
||||
async function createMainWindow(app) {
|
||||
function createMainWindow(app) {
|
||||
const windowStateKeeper = require('electron-window-state'); // should not be statically imported
|
||||
|
||||
const mainWindowState = windowStateKeeper({
|
||||
// default window width & height so it's usable on 1600 * 900 display (including some extra panels etc.)
|
||||
// default window width & height, so it's usable on 1600 * 900 display (including some extra panels etc.)
|
||||
defaultWidth: 1200,
|
||||
defaultHeight: 800
|
||||
});
|
||||
|
||||
6
src/www
6
src/www
@@ -25,10 +25,10 @@ const log = require('./services/log');
|
||||
const appInfo = require('./services/app_info');
|
||||
const ws = require('./services/ws');
|
||||
const utils = require('./services/utils');
|
||||
const sqlInit = require('./services/sql_init');
|
||||
const port = require('./services/port');
|
||||
const host = require('./services/host');
|
||||
const semver = require('semver');
|
||||
const beccaLoader = require("./becca/becca_loader");
|
||||
|
||||
if (!semver.satisfies(process.version, ">=10.5.0")) {
|
||||
console.error("Trilium only supports node.js 10.5 and later");
|
||||
@@ -95,6 +95,10 @@ async function startTrilium() {
|
||||
const cpuInfos = require('os').cpus();
|
||||
log.info(`CPU model: ${cpuInfos[0].model}, logical cores: ${cpuInfos.length} freq: ${cpuInfos[0].speed} Mhz`); // for perf. issues it's good to know the rough configuration
|
||||
|
||||
if (!utils.isElectron()) {
|
||||
beccaLoader.loadInitially();
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user