Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
server-ts: Port services/one_time_timer
Elian Dorandbccf6b43348
diff --git a/src/services/handlers.js b/src/services/handlers.jsindex 16cdd77336..11c9ef5fe7 100644--- a/src/services/handlers.js+++ b/src/services/handlers.js@@ -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) {diff --git a/src/services/one_time_timer.js b/src/services/one_time_timer.tssimilarity index 77%rename from src/services/one_time_timer.jsrename to src/services/one_time_timer.tsindex 648c250bbe..033a8b3c16 100644--- a/src/services/one_time_timer.js+++ b/src/services/one_time_timer.ts@@ -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};