renamed "messagingService" to "ws"

This commit is contained in:
zadam
2019-08-26 20:21:43 +02:00
parent d039a5f24e
commit 36c87b7fa0
21 changed files with 52 additions and 52 deletions

View File

@@ -10,7 +10,7 @@ const repository = require('./repository');
const axios = require('axios');
const dayjs = require('dayjs');
const cloningService = require('./cloning');
const messagingService = require('./messaging');
const ws = require('./ws.js');
const appInfo = require('./app_info');
const searchService = require('./search');
@@ -211,7 +211,7 @@ function BackendScriptApi(currentNote, apiParams) {
this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) {
await noteService.createNote(parentNoteId, title, content, extraOptions);
messagingService.refreshTree();
ws.refreshTree();
};
/**
@@ -307,7 +307,7 @@ function BackendScriptApi(currentNote, apiParams) {
*
* @returns {Promise<void>}
*/
this.refreshTree = messagingService.refreshTree;
this.refreshTree = ws.refreshTree;
/**
* @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version

View File

@@ -3,7 +3,7 @@
const sql = require('./sql');
const sqlInit = require('./sql_init');
const log = require('./log');
const messagingService = require('./messaging');
const ws = require('./ws.js');
const syncMutexService = require('./sync_mutex');
const repository = require('./repository');
const cls = require('./cls');
@@ -381,13 +381,13 @@ async function runChecks() {
});
if (fixedIssues) {
messagingService.refreshTree();
ws.refreshTree();
}
if (unrecoverableConsistencyErrors) {
log.info(`Consistency checks failed (took ${elapsedTimeMs}ms)`);
messagingService.sendMessageToAllClients({type: 'consistency-checks-failed'});
ws.sendMessageToAllClients({type: 'consistency-checks-failed'});
}
else {
log.info(`All consistency checks passed (took ${elapsedTimeMs}ms)`);

View File

@@ -4,7 +4,7 @@ const sql = require('./sql');
const utils = require('./utils');
const log = require('./log');
const eventLogService = require('./event_log');
const messagingService = require('./messaging');
const ws = require('./ws.js');
const ApiToken = require('../entities/api_token');
const Branch = require('../entities/branch');
const Note = require('../entities/note');
@@ -60,7 +60,7 @@ async function checkContentHashes(otherHashes) {
if (key !== 'recent_notes') {
// let's not get alarmed about recent notes which get updated often and can cause failures in race conditions
await messagingService.sendMessageToAllClients({type: 'sync-hash-check-failed'});
await ws.sendMessageToAllClients({type: 'sync-hash-check-failed'});
}
}
}

View File

@@ -1,6 +1,6 @@
"use strict";
const messagingService = require('./messaging');
const ws = require('./ws.js');
// importId => ImportContext
const importContexts = {};
@@ -36,7 +36,7 @@ class ImportContext {
if (Date.now() - this.lastSentCountTs >= 500) {
this.lastSentCountTs = Date.now();
await messagingService.sendMessageToAllClients({
await ws.sendMessageToAllClients({
importId: this.importId,
type: 'import-progress-count',
progressCount: this.progressCount
@@ -46,7 +46,7 @@ class ImportContext {
// must remaing non-static
async reportError(message) {
await messagingService.sendMessageToAllClients({
await ws.sendMessageToAllClients({
type: 'import-error',
message: message
});