generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 20
/
types.d.ts
62 lines (59 loc) · 1.41 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as obsidian from 'obsidian';
import { DataviewAPI } from 'obsidian-dataview';
export type CustomJSType = {
obsidian?: typeof obsidian;
app?: obsidian.App;
state?: Record<string, unknown>;
[scriptName: string]: unknown;
};
declare global {
interface Window {
forceLoadCustomJS?: () => Promise<void>;
cJS?: (
moduleOrCallback?: string | ((customJS: CustomJSType) => void),
) => Promise<unknown>;
customJS?: CustomJSType;
}
}
declare module 'obsidian' {
interface App {
plugins: {
enabledPlugins: Set<string>;
plugins: {
[id: string]: unknown;
dataview?: {
api?: DataviewAPI;
manifest: {
version: string;
};
};
};
};
setting: {
openTabById: (tabId: 'hotkeys') => {
searchComponent: SearchComponent;
updateHotkeyVisibility: () => void;
};
};
commands: {
removeCommand: (commandName: string) => void;
};
}
interface MetadataCache {
on(
name: 'dataview:api-ready',
callback: (api: DataviewAPI) => unknown,
ctx?: unknown,
): EventRef;
on(
name: 'dataview:metadata-change',
callback: (
...args:
| [op: 'rename', file: TAbstractFile, oldPath: string]
| [op: 'delete', file: TFile]
| [op: 'update', file: TFile]
) => unknown,
ctx?: unknown,
): EventRef;
}
}