chore(client/ts): port services/frontend_script_api

This commit is contained in:
Elian Doran
2024-12-19 22:06:42 +02:00
parent 7b7980cefb
commit 650a116193
4 changed files with 476 additions and 448 deletions

View File

@@ -14,6 +14,7 @@ import MainTreeExecutors from "./main_tree_executors.js";
import toast from "../services/toast.js";
import ShortcutComponent from "./shortcut_component.js";
import { t, initLocale } from "../services/i18n.js";
import NoteDetailWidget from "../widgets/note_detail.js";
interface Layout {
getRootWidget: (appContext: AppContext) => RootWidget;
@@ -27,11 +28,18 @@ interface BeforeUploadListener extends Component {
beforeUnloadEvent(): boolean;
}
interface TriggerData {
export type TriggerData = {
noteId?: string;
noteIds?: string[];
messages?: unknown[];
messages?: unknown[];
callback?: () => void;
} | {
ntxId: string;
notePath: string;
} | {
text: string;
} | {
callback: (value: NoteDetailWidget | PromiseLike<NoteDetailWidget>) => void
}
class AppContext extends Component {

View File

@@ -1,4 +1,4 @@
type Callback = () => Promise<void>;
type Callback = () => Promise<void> | void;
export default class SpacedUpdate {
private updater: Callback;

View File

@@ -34,6 +34,7 @@ interface CustomGlobals {
maxEntityChangeIdAtLoad: number;
maxEntityChangeSyncIdAtLoad: number;
assetPath: string;
instanceName: string;
}
type RequireMethod = (moduleName: string) => any;
@@ -64,7 +65,7 @@ declare global {
};
interface JQuery {
autocomplete: (action: "close" | "open" | "destroy" | AutoCompleteConfig, args?: AutoCompleteArg[]) => void;
autocomplete: (action: "close" | "open" | "destroy" | AutoCompleteConfig, args?: AutoCompleteArg[]) => void;
}
var logError: (message: string) => void;
@@ -83,4 +84,5 @@ declare global {
language: string
});
};
var dayjs: {};
}