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
import { BootstrapDefinition, ElectronApi, ElectronContextMenuParams, StandaloneApi } from "@triliumnext/commons";
import appContext, { AppContext } from "./components/app_context";
import type triliumPerf from "./services/debug_perf";
import type FNote from "./entities/fnote";
import type { PrintReport } from "./print";
import type { lint } from "./services/eslint";
import type { Froca } from "./services/froca-interface";
import { Library } from "./services/library_loader";
import server from "./services/server";
import utils from "./services/utils";
interface ElectronProcess {
type: string;
platform: string;
}
interface CustomGlobals extends BootstrapDefinition {
isDesktop: typeof utils.isDesktop;
isMobile: typeof utils.isMobile;
getComponentByEl: typeof appContext.getComponentByEl;
getHeaders: typeof server.getHeaders;
getReferenceLinkTitle: (href: string) => Promise<string>;
getReferenceLinkTitleSync: (href: string, storedTitle?: string) => string;
getActiveContextNote: () => FNote | null;
getThemeStyle: () => "auto" | "light" | "dark";
ESLINT: Library;
appContext: AppContext;
froca: Froca;
treeCache: Froca;
SEARCH_HELP_TEXT: string;
activeDialog: JQuery<HTMLElement> | null;
componentId: string;
linter: typeof lint;
}
type RequireMethod = (moduleName: string) => any;
declare global {
interface Window {
$: JQueryStatic;
jQuery: JQueryStatic;
logError(message: string);
logInfo(message: string);
/** Opt-in main-thread profiler, driven from the devtools console. See `services/debug_perf`. */
triliumPerf: typeof triliumPerf;
process?: ElectronProcess;
glob?: CustomGlobals;
/** On the printing endpoint, set to true when the note has fully loaded and is ready to be printed/exported as PDF. */
_noteReady?: PrintReport;
EXCALIDRAW_ASSET_PATH?: string;
Capacitor?: {
isNativePlatform?: () => boolean;
getPlatform?: () => string;
};
/**
* Called by the Android app's `MainActivity` on the system back gesture or button; `false`
* leaves the app to go to the background. See `services/system_back.ts`.
*/
__triliumHandleBack?: () => boolean;
electronApi?: ElectronApi;
/** Present only in the standalone build, where the stack runs in this browser. */
standaloneApi?: StandaloneApi;
/**
* Chromium's Local Font Access API, absent from the DOM typings. Defined only in a secure
* context on Chromium, and it rejects unless the `local-fonts` permission is granted — see
* `listSystemFontFamilies`, which is the only caller.
*/
queryLocalFonts?: () => Promise<FontData[]>;
}
/** One installed font face, as {@link Window.queryLocalFonts} reports it. */
interface FontData {
family: string;
fullName: string;
postscriptName: string;
style: string;
}
interface WindowEventMap {
"note-ready": Event;
"note-load-progress": CustomEvent<{ progress: number }>;
}
var logError: (message: string, e?: unknown) => void;
var logInfo: (message: string) => void;
var glob: CustomGlobals;
//@ts-ignore
var require: RequireMethod;
}