Skip to content

Build your personal knowledge base with Trilium Notes

docs(script-api): address review feedback

Elian Doranbd14bc4ca77e
diff --git a/apps/client/src/services/frontend_script_api.ts b/apps/client/src/services/frontend_script_api.ts
index a268b6fb9a..80823f383e 100644
--- a/apps/client/src/services/frontend_script_api.ts
+++ b/apps/client/src/services/frontend_script_api.ts
@@ -70,7 +70,7 @@ export interface Api {
/**
* Note where the script execution started — the entry point of the current script bundle
* (in C terms, the file containing `main()`). When a script is spread across multiple code
- * notes (descendant code notes loaded as modules via `api.require()`), every note in the
+ * notes (descendant code notes loaded as modules via `require()`), every note in the
* bundle shares the same `startNote`, while {@link currentNote} differs per note.
* Messages from `api.log()` are grouped under this note.
*/
@@ -79,7 +79,7 @@ export interface Api {
/**
* Note containing the source code that is currently executing (in C terms, `__FILE__`).
* Equal to {@link startNote} unless execution has moved into a descendant module note
- * loaded via `api.require()`. Don't confuse this with the note open in the UI — use
+ * loaded via `require()`. Don't confuse this with the note open in the UI — use
* `api.getActiveContextNote()` for that.
*/
currentNote: FNote;
diff --git a/packages/commons/src/lib/script_api.ts b/packages/commons/src/lib/script_api.ts
index 99a415c790..be023f2c97 100644
--- a/packages/commons/src/lib/script_api.ts
+++ b/packages/commons/src/lib/script_api.ts
@@ -139,7 +139,7 @@ export interface FrontendApi {
/**
* Note where the script execution started — the entry point of the current script bundle
* (in C terms, the file containing `main()`). When a script is spread across multiple code
- * notes (descendant code notes loaded as modules via `api.require()`), every note in the
+ * notes (descendant code notes loaded as modules via `require()`), every note in the
* bundle shares the same `startNote`, while {@link currentNote} differs per note.
* Messages from `api.log()` are grouped under this note.
*/
@@ -147,7 +147,7 @@ export interface FrontendApi {
/**
* Note containing the source code that is currently executing (in C terms, `__FILE__`).
* Equal to {@link startNote} unless execution has moved into a descendant module note
- * loaded via `api.require()`. Don't confuse this with the note open in the UI — use
+ * loaded via `require()`. Don't confuse this with the note open in the UI — use
* `api.getActiveContextNote()` for that.
*/
currentNote: ScriptFNote;
@@ -607,7 +607,7 @@ export interface BackendApi {
/**
* Note where the script execution started — the entry point of the current script bundle
* (in C terms, the file containing `main()`). When a script is spread across multiple code
- * notes (descendant code notes loaded as modules via `api.require()`), every note in the
+ * notes (descendant code notes loaded as modules via `require()`), every note in the
* bundle shares the same `startNote`, while {@link currentNote} differs per note.
* Messages from `api.log()` are grouped under this note.
*
@@ -618,7 +618,7 @@ export interface BackendApi {
/**
* Note containing the source code that is currently executing (in C terms, `__FILE__`).
* Equal to {@link startNote} unless execution has moved into a descendant module note
- * loaded via `api.require()`. Don't confuse this with the concept of the active note in
+ * loaded via `require()`. Don't confuse this with the concept of the active note in
* the UI.
*/
currentNote: ScriptBNote;
@@ -632,7 +632,8 @@ export interface BackendApi {
* - `~runOnChildNoteCreation` — the newly created child note;
* - `~runOnAttributeCreation`, `~runOnAttributeChange` — the attribute;
* - `~runOnBranchCreation`, `~runOnBranchChange`, `~runOnBranchDeletion` — the branch;
- * - scheduled scripts (`#run=hourly` / `#run=daily`) — the script note itself;
+ * - scheduled scripts (`#run=backendStartup` / `#run=hourly` / `#run=daily`) — the
+ * script note itself;
* - search scripts (`~searchScript`) — the search note.
*/
originEntity?: unknown | null;
diff --git a/packages/trilium-core/src/services/backend_script_api.ts b/packages/trilium-core/src/services/backend_script_api.ts
index 894671177c..d764a32890 100644
--- a/packages/trilium-core/src/services/backend_script_api.ts
+++ b/packages/trilium-core/src/services/backend_script_api.ts
@@ -63,7 +63,7 @@ export interface Api {
/**
* Note where the script execution started — the entry point of the current script bundle
* (in C terms, the file containing `main()`). When a script is spread across multiple code
- * notes (descendant code notes loaded as modules via `api.require()`), every note in the
+ * notes (descendant code notes loaded as modules via `require()`), every note in the
* bundle shares the same `startNote`, while {@link currentNote} differs per note.
* Messages from `api.log()` are grouped under this note.
*
@@ -75,7 +75,7 @@ export interface Api {
/**
* Note containing the source code that is currently executing (in C terms, `__FILE__`).
* Equal to {@link startNote} unless execution has moved into a descendant module note
- * loaded via `api.require()`. Don't confuse this with the concept of the active note in
+ * loaded via `require()`. Don't confuse this with the concept of the active note in
* the UI.
*/
currentNote: BNote;
@@ -90,7 +90,8 @@ export interface Api {
* - `~runOnChildNoteCreation` — the newly created child note;
* - `~runOnAttributeCreation`, `~runOnAttributeChange` — the attribute;
* - `~runOnBranchCreation`, `~runOnBranchChange`, `~runOnBranchDeletion` — the branch;
- * - scheduled scripts (`#run=hourly` / `#run=daily`) — the script note itself;
+ * - scheduled scripts (`#run=backendStartup` / `#run=hourly` / `#run=daily`) — the
+ * script note itself;
* - search scripts (`~searchScript`) — the search note.
*/
originEntity?: AbstractBeccaEntity<any> | null;