Skip to content

Commit 43477c9

Browse files
committed
add way to get Obsidian module
1 parent 2a2cfe4 commit 43477c9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

jsEngine/api/API.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type JsEnginePlugin from 'jsEngine/main';
1111
import type { Validators } from 'jsEngine/utils/Validators';
1212
import { validateAPIArgs } from 'jsEngine/utils/Validators';
1313
import type { App, Plugin } from 'obsidian';
14+
import * as Obsidian from 'obsidian';
1415
import { z } from 'zod';
1516

1617
export class API {
@@ -95,6 +96,20 @@ export class API {
9596
return this.app.plugins.getPlugin(pluginId) ?? undefined;
9697
}
9798

99+
/**
100+
* Gets the obsidian module.
101+
* This allows you to access all things exported by the obsidian module.
102+
*
103+
* @example
104+
* ```js
105+
* const obsidian = engine.getObsidianModule();
106+
* new obsidian.Notice('Hello World!');
107+
* ```
108+
*/
109+
public getObsidianModule(): typeof Obsidian {
110+
return Obsidian;
111+
}
112+
98113
/**
99114
* Creates a reactive component.
100115
* Reactive components are useful for creating dynamic content.

0 commit comments

Comments
 (0)