requirePlugin<TPlugin>
Waits for another plugin to become PluginAvailability.Available, asking the user to repair it while it is not.
Resolves at once when it already is. Otherwise, once the workspace layout is ready — before that, a plugin Obsidian has not loaded yet is indistinguishable from a missing one — a notice says what is wrong and offers the matching repair: install, enable, or update, plus a way to the community plugins list. The notice follows the state as it changes and goes away when the wait settles. A repair that fails is reported and leaves the wait running, so the user can try again or fix it by hand.
The promise settles ONCE. It does not watch the plugin afterwards: a consumer that must stop when the plugin goes away declares a dependency through PluginBase.getPluginDependencies() instead.
Import:
import { requirePlugin } from '@mnaoumov/obsidian-lib/plugin/plugin-instance';Signature:
function requirePlugin(params: RequirePluginParams<NoInfer<TPlugin>>): Promise<TPlugin>Parameters:
| Parameter | Type | Description |
|---|---|---|
params |
RequirePluginParams<NoInfer<TPlugin>> | The RequirePluginParams. |
Returns: Promise<TPlugin> — A Promise resolving with the instance.
Links to this page: