Skip to content

Plugins

Unofficial

Manager for community plugins, handling installation, enabling, and lifecycle.

Import:

import type { Plugins } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface Plugins extends Events

Extends: Events

Constructor

new Plugins(app: App)

Constructor.

To get the constructor instance, use getPluginsConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
_Record<string, EventsEntry[]>Internal storage of registered event handlers by event name.
(Inherited from Events)
appAppReference to the obsidian#App.
autoCheckForUpdatesbooleanWhether automatic update checking is enabled.
didChangeDebouncer<[], void>Debounced callback that fires a changed event when the plugin set changes.
enabledPluginsSet<string>Set of enabled plugin IDs.
lastUpdateChecknumberTimestamp of the last update check.
loadingPluginIdnull | stringobsidian#Plugin ID that is currently being enabled.
manifestsPluginsManifestsRecordManifests of all the plugins that are installed.
pluginsPluginsPluginsRecordMapping of plugin ID to active plugin instance.
requestSaveConfigDebouncer<[], Promise<void>>Debounced function to save the plugin configuration.
updatesMap<string, PluginUpdateManifest>Mapping of plugin ID to available updates.

Methods

MethodReturnsDescription
checkForDeprecations()Promise<void>Check online list for deprecated plugins to automatically disable.
checkForUpdates(showNotice?)Promise<void>Check for plugin updates.
clearEnabledPlugins()Promise<void>Clears the set of enabled plugins and persists the change.
disablePlugin(id, isUserDisabled?)Promise<void>Unload a plugin by ID.
disablePluginAndSave(id)Promise<void>Unload a plugin by ID and save config for persistence.
enablePlugin(id, isUserEnabled?)Promise<boolean>Enable a plugin by ID.
enablePluginAndSave(id)Promise<boolean>Enable a plugin by ID and save config for persistence.
getPlugin(id)null | PluginGet a plugin by ID.
getPluginFolder()stringGet the folder where plugins are stored.
getPluginManifest(id)null | PluginManifestGet the loaded manifest of an installed plugin.
initialize()Promise<void>Load plugin manifests and enable plugins from config.
installPlugin(repo, version, manifest)Promise<void>Install a plugin from a given URL.
isDeprecated(id)booleanCheck whether a plugin is deprecated.
isEnabled()booleanCheck whether community plugins are enabled.
isInstalled(id, dir)Promise<boolean>Check whether a plugin is installed: its manifest is loaded, or the given folder holds a manifest with its ID.
loadManifest(path)Promise<void>Load a specific plugin's manifest by its folder path.
loadManifests()Promise<void>Load all plugin manifests from plugin folder.
loadPlugin(id, isUserEnabled?)Promise<Plugin>Load a plugin by its ID.
off(name, callback)voidRemove an event listener.
(Inherited from Events)
offref(ref)voidRemove an event listener by reference.
(Inherited from Events)
on(name, callback, ctx?)EventRefAdd an event listener.
(Inherited from Events)
onRaw(e)voidHandle raw file system change events for plugin config files.
readManifest(dir)Promise<null | PluginManifest>Read and validate the manifest.json in a plugin folder, without loading it.

Sets the manifest's dir to the folder, and clears an author that is empty or Obsidian.
saveConfig()Promise<void>Save current plugin configs.
setAutomaticUpdateCheck(enabled)voidSet whether automatic update checking is enabled.
setEnable(enabled)Promise<void>Toggle whether community plugins are enabled.
trigger(name, data?)voidTrigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from Events)
tryTrigger(evt, args)voidTry to trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from Events)
uninstallPlugin(id)Promise<void>Uninstall a plugin by ID.
unloadPlugin(id, isUserDisabled?)Promise<void>Unload a plugin by ID.
writePluginFiles(id, files)Promise<string>Write a plugin's release files into its folder under Plugins.getPluginFolder, creating the folders as needed and removing a stale styles.css when the release has none.

Links to this page: