Skip to content

InternalPlugin<InternalPluginInstance>

Unofficial

Base interface for an internal plugin registration, managing lifecycle, commands, and views.

Import:

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

Signature:

export interface InternalPlugin<InternalPluginInstance> extends Component

Extends: Component

Constructor

new InternalPlugin(app: App, instance: InternalPluginInstance, internalPlugins: InternalPlugins)

Constructor.

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

Properties

Property Type Description
_children Component[] Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from Component)
_events EventRef[] Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from Component)
_loaded boolean Whether the component and its children are loaded.
(Inherited from Component)
addedButtonEls HTMLDivElement[] Button elements added by this plugin.
app App Reference to the app.
commands Command[] Commands registered by this plugin.
enabled boolean Whether this plugin is currently enabled.
hasStatusBarItem boolean Whether this plugin has a status bar item.
instance InternalPluginInstance The plugin instance containing the actual logic.
lastSave number Timestamp of the last settings save.
manager InternalPlugins Reference to the internal plugins manager.
mobileFileInfo MobileFileInfo[] Mobile file info renderers registered by this plugin.
onConfigFileChange Debouncer<[], Promise<void>> Debounced handler for config file changes.
ribbonItems RibbonItem[] Ribbon items registered by this plugin.
statusBarEl HTMLDivElement | null Status bar element for this plugin, or null if none.
views Record<string, ViewCreator> View creators registered by this plugin, keyed by view type.

Methods

Method Returns Description
addChild(component) T Adds a child component, loading it if this component is loaded.
(Inherited from Component)
addSettingTab(settingTab) void Add a settings tab for this plugin.
deleteData() Promise<void> Delete persisted data for this plugin.
disable(isDisabledByUser?) void Disable this plugin.
enable(isEnabledByUser?) Promise<void> Enable this plugin.
getModifiedTime() Promise<number | undefined> Get the last modified time of the plugin config file.
handleConfigFileChange() Promise<void> Handle changes to the plugin config file.
init() void Initialize this plugin.
load() void Load this component and its children.
(Inherited from Component)
loadData() Promise<null | object> Load persisted data for this plugin.
onload() void Override this to load your component.
(Inherited from Component)
onunload() void Override this to unload your component
(Inherited from Component)
register(cb) void Registers a callback to be called when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?) void Registers a DOM event to be detached when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?) void Registers a DOM event to be detached when unloading
(Inherited from Component)
registerDomEvent(el, type, callback, options?) void Registers a DOM event to be detached when unloading
(Inherited from Component)
registerEvent(eventRef) void Registers an event to be detached when unloading.
(Inherited from Component)
registerGlobalCommand(command) void Register a global command for this plugin.
registerInterval(id) number Registers an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
(Inherited from Component)
registerMobileFileInfo(renderCallback) void Register a mobile file info renderer callback.
registerRibbonItem(title, icon, callback) void Register a ribbon item button for this plugin.
registerScopeEvent(keymapEventHandler) void Register a scope keymap event handler to be removed on unload.
(Inherited from Component)
registerStatusBarItem() void Register a status bar item for this plugin.
registerViewType(type, creator) void Register a view type with its creator function.
removeChild(component) T Removes a child component, unloading it.
(Inherited from Component)
saveData(data) Promise<void> Save data for this plugin.
unload() void Override this to unload your component.
(Inherited from Component)

Links to this page: