SyncPluginInstance
Unofficial
Plugin instance for Obsidian Sync, managing cloud synchronization of vault data.
Import:
import type { SyncPluginInstance } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export interface SyncPluginInstance extends InternalPluginInstance<SyncPlugin>Extends: InternalPluginInstance<SyncPlugin>
Properties
| Property | Type | Description | |
|---|---|---|---|
| app | App | Reference to the app. | |
| description | string | Human-readable description of this plugin. (Inherited from InternalPluginInstance) | |
| filter | SyncFilter | The selective-sync filter. | |
| id | string | Unique identifier for this plugin. (Inherited from InternalPluginInstance) | |
| localFiles | Record<string, SyncLocalFile> | The local file records, keyed by vault path. | |
| name | string | Human-readable display name of this plugin. (Inherited from InternalPluginInstance) | |
| plugin | SyncPlugin | Reference to the sync plugin registration. | |
| serverFiles | Record<string, SyncServerFile> | The file records the server pushed, keyed by vault path. | |
| skippedFiles | Record<string, string> | The reason each skipped file was last skipped, keyed by vault path, so the same reason is logged once. | |
| statusIconEl | HTMLElement | null | The Sync status icon, in the status bar on desktop or the header on mobile; null before it is created. | |
| syncStatus | string | The status text shown in the status icon's tooltip, such as Connecting to server. | |
| vaultId | null | string | The id of the connected remote vault, null when none is connected. | |
| vaultName | null | string | The name of the connected remote vault, null when none is connected. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| boundOnFileAdd(file) | void | SyncPluginInstance.onFileAdd bound to the instance, registered for the vault create and modify events. | |
| boundOnFileRemove(file) | void | SyncPluginInstance.onFileRemove bound to the instance, registered for the vault delete event. | |
| boundOnFileRename(file, oldPath) | void | SyncPluginInstance.onFileRename bound to the instance, registered for the vault rename event. | |
| changeFilter(change) | void | Apply a selective-sync filter change and queue the files it newly allows. | |
| getRemoteVaultId() | null | string | Get the id of the connected remote vault. | |
| getRemoteVaultName() | null | string | Get the name of the connected remote vault. | |
| getStatus() | SyncStatus | Get the current sync state. | |
| init(app, plugin) | void | Initialize the plugin instance with app and plugin references. (Inherited from InternalPluginInstance) | |
| onDisable(app, plugin) | void | Called when the plugin is disabled. (Inherited from InternalPluginInstance) | |
| onEnable(app, plugin) | Promise<void> | Called when the plugin is enabled. (Inherited from InternalPluginInstance) | |
| onFileAdd(file) | void | Create or update the local file record of a file or folder, and request a sync. | |
| onFileRemove(file) | void | Drop the local file record of a deleted file or folder, and request a sync. | |
| onFileRename(file, oldPath) | void | Move 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) | void | Called when the user manually disables the plugin. (Inherited from InternalPluginInstance) | |
| onUserEnable(app) | void | Called when the user manually enables the plugin. (Inherited from InternalPluginInstance) | |
| scanFiles() | void | Record 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) | void | Include or exclude a configuration kind from sync. | |
| setIgnoreFolders(ignoreFolders) | void | Replace the folders excluded from sync. | |
| setRemoteVaultName(name) | Promise<void> | Rename the connected remote vault locally and save the sync data. | |
| setSyncType(type, isEnabled) | void | Include or exclude an attachment kind from sync. |
Links to this page: