Skip to content

SyncPluginInstance

Unofficial

Plugin instance for Obsidian Sync, managing cloud synchronization of vault data.

Import:

import type { SyncPluginInstance } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface SyncPluginInstance extends InternalPluginInstance<SyncPlugin>

Extends: InternalPluginInstance<SyncPlugin>

Properties

PropertyTypeDescription
appAppReference to the app.
descriptionstringHuman-readable description of this plugin.
(Inherited from InternalPluginInstance)
filterSyncFilterThe selective-sync filter.
idstringUnique identifier for this plugin.
(Inherited from InternalPluginInstance)
localFilesRecord<string, SyncLocalFile>The local file records, keyed by vault path.
namestringHuman-readable display name of this plugin.
(Inherited from InternalPluginInstance)
pluginSyncPluginReference to the sync plugin registration.
serverFilesRecord<string, SyncServerFile>The file records the server pushed, keyed by vault path.
skippedFilesRecord<string, string>The reason each skipped file was last skipped, keyed by vault path, so the same reason is logged once.
statusIconElHTMLElement | nullThe Sync status icon, in the status bar on desktop or the header on mobile; null before it is created.
syncStatusstringThe status text shown in the status icon's tooltip, such as Connecting to server.
vaultIdnull | stringThe id of the connected remote vault, null when none is connected.
vaultNamenull | stringThe name of the connected remote vault, null when none is connected.

Methods

MethodReturnsDescription
boundOnFileAdd(file)voidSyncPluginInstance.onFileAdd bound to the instance, registered for the vault create and modify events.
boundOnFileRemove(file)voidSyncPluginInstance.onFileRemove bound to the instance, registered for the vault delete event.
boundOnFileRename(file, oldPath)voidSyncPluginInstance.onFileRename bound to the instance, registered for the vault rename event.
changeFilter(change)voidApply a selective-sync filter change and queue the files it newly allows.
getRemoteVaultId()null | stringGet the id of the connected remote vault.
getRemoteVaultName()null | stringGet the name of the connected remote vault.
getStatus()SyncStatusGet the current sync state.
init(app, plugin)voidInitialize the plugin instance with app and plugin references.
(Inherited from InternalPluginInstance)
onDisable(app, plugin)voidCalled when the plugin is disabled.
(Inherited from InternalPluginInstance)
onEnable(app, plugin)Promise<void>Called when the plugin is enabled.
(Inherited from InternalPluginInstance)
onFileAdd(file)voidCreate or update the local file record of a file or folder, and request a sync.
onFileRemove(file)voidDrop the local file record of a deleted file or folder, and request a sync.
onFileRename(file, oldPath)voidMove the local file record to the new path, keep the oldest path not yet pushed in SyncLocalFile.previouspath, mark it as changed, and request a sync.
onUserDisable(app)voidCalled when the user manually disables the plugin.
(Inherited from InternalPluginInstance)
onUserEnable(app)voidCalled when the user manually enables the plugin.
(Inherited from InternalPluginInstance)
scanFiles()voidRecord every file and folder in the vault in SyncPluginInstance.localFiles, drop the records of paths that no longer exist, and schedule a scan of the configuration folder.
setAllowSpecialFile(type, isEnabled)voidInclude or exclude a configuration kind from sync.
setIgnoreFolders(ignoreFolders)voidReplace the folders excluded from sync.
setRemoteVaultName(name)Promise<void>Rename the connected remote vault locally and save the sync data.
setSyncType(type, isEnabled)voidInclude or exclude an attachment kind from sync.

Links to this page: