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-public-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

PropertyTypeDescription
_childrenComponent[]Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from Component)
_eventsEventRef[]Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from Component)
_loadedbooleanWhether the component and its children are loaded.
(Inherited from Component)
addedButtonElsHTMLDivElement[]Button elements added by this plugin.
appAppReference to the app.
commandsCommand[]Commands registered by this plugin.
enabledbooleanWhether this plugin is currently enabled.
hasStatusBarItembooleanWhether this plugin has a status bar item.
instanceInternalPluginInstanceThe plugin instance containing the actual logic.
lastSavenumberTimestamp of the last settings save.
managerInternalPluginsReference to the internal plugins manager.
mobileFileInfoMobileFileInfo[]Mobile file info renderers registered by this plugin.
onConfigFileChangeDebouncer<[], Promise<void>>Debounced handler for config file changes.
ribbonItemsRibbonItem[]Ribbon items registered by this plugin.
statusBarElHTMLDivElement | nullStatus bar element for this plugin, or null if none.
viewsRecord<string, ViewCreator>View creators registered by this plugin, keyed by view type.

Methods

MethodReturnsDescription
addChild(component)TAdds a child component, loading it if this component is loaded.
(Inherited from Component)
addSettingTab(settingTab)voidAdd a settings tab for this plugin.
deleteData()Promise<void>Delete persisted data for this plugin.
disable(isDisabledByUser?)voidDisable 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()voidInitialize this plugin.
load()voidLoad this component and its children.
(Inherited from Component)
loadData()Promise<null | object>Load persisted data for this plugin.
onload()voidOverride this to load your component.
(Inherited from Component)
onunload()voidOverride this to unload your component
(Inherited from Component)
register(cb)voidRegisters a callback to be called when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerEvent(eventRef)voidRegisters an event to be detached when unloading.
(Inherited from Component)
registerGlobalCommand(command)voidRegister a global command for this plugin.
registerInterval(id)numberRegisters 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)voidRegister a mobile file info renderer callback.
registerRibbonItem(title, icon, callback)voidRegister a ribbon item button for this plugin.
registerScopeEvent(keymapEventHandler)voidRegister a scope keymap event handler to be removed on unload.
(Inherited from Component)
registerStatusBarItem()voidRegister a status bar item for this plugin.
registerViewType(type, creator)voidRegister a view type with its creator function.
removeChild(component)TRemoves a child component, unloading it.
(Inherited from Component)
saveData(data)Promise<void>Save data for this plugin.
unload()voidOverride this to unload your component.
(Inherited from Component)

Links to this page: