mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 03:06:37 +08:00
server-ts: Port services/one_time_timer
This commit is contained in:
parent
6df09cb157
commit
dbccf6b433
2 changed files with 4 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ const noteService = require('./notes');
|
|||
const becca = require('../becca/becca');
|
||||
const BAttribute = require('../becca/entities/battribute');
|
||||
const hiddenSubtreeService = require('./hidden_subtree');
|
||||
const oneTimeTimer = require('./one_time_timer.js');
|
||||
const oneTimeTimer = require('./one_time_timer');
|
||||
|
||||
function runAttachedRelations(note, relationName, originEntity) {
|
||||
if (!note) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const scheduledExecutions = {};
|
||||
const scheduledExecutions: Record<string, boolean> = {};
|
||||
|
||||
/**
|
||||
* Subsequent calls will not move the timer to the future. The first caller determines the time of execution.
|
||||
|
|
@ -6,7 +6,7 @@ const scheduledExecutions = {};
|
|||
* The good thing about synchronous better-sqlite3 is that this cannot interrupt transaction. The execution will be called
|
||||
* only outside of a transaction.
|
||||
*/
|
||||
function scheduleExecution(name, milliseconds, cb) {
|
||||
function scheduleExecution(name: string, milliseconds: number, cb: () => void) {
|
||||
if (name in scheduledExecutions) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ function scheduleExecution(name, milliseconds, cb) {
|
|||
}, milliseconds);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
scheduleExecution
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue