-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Add obisidian API's free functions to API #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Adds the obsidian free functions to the `app` object under the `functions` object.
Aren't these already available as |
Usage of global app is discouraged, see: and:
|
No, the free functions like |
I'm afraid I don't think it's a great idea to modify the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work. keep in mind that monkey patching app
is advised against, because it's not a matter of "if" but "when" an update to obsidian itself will break everything.
@@ -17,6 +17,7 @@ declare module "obsidian" { | |||
} | |||
interface App { | |||
appId?: string; | |||
functions: Record<string, typeof Function>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this. don't add new properties to app
.
} | ||
} | ||
} | ||
this.app.functions = obsidianFreeFunctions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.app.functions = obsidianFreeFunctions; | |
window.obsidian = obsidianFreeFunctions; |
Adds the Obsidian free functions to the
app
object under thefunctions
object.This provides access to a bunch of useful built-in Obsidian utilities via the local API.