mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 16:26:31 +01:00
Merge branch 'beta'
# Conflicts: # docs/backend_api/BAttachment.html # docs/backend_api/BNote.html # docs/backend_api/BackendScriptApi.html # package-lock.json # package.json
This commit is contained in:
@@ -47,6 +47,7 @@ const SpacedUpdate = require("./spaced_update");
|
||||
const specialNotesService = require("./special_notes");
|
||||
const branchService = require("./branches");
|
||||
const exportService = require("./export/zip");
|
||||
const syncMutex = require("./sync_mutex.js");
|
||||
|
||||
|
||||
/**
|
||||
@@ -628,6 +629,20 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sync process can make data intermittently inconsistent. Scripts which require strong data consistency
|
||||
* can use this function to wait for a possible sync process to finish and prevent new sync process from starting
|
||||
* while it is running.
|
||||
*
|
||||
* Because this is an async process, the inner callback doesn't have automatic transaction handling, so in case
|
||||
* you need to make some DB changes, you need to surround your call with api.transactional(...)
|
||||
*
|
||||
* @method
|
||||
* @param {function} callback - function to be executed while sync process is not running
|
||||
* @returns {Promise} - resolves once the callback is finished (callback is awaited)
|
||||
*/
|
||||
this.runOutsideOfSync = syncMutex.doExclusively;
|
||||
|
||||
/**
|
||||
* This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user