registerAsyncDisposable<TAsyncDisposable>
Registers an AsyncDisposable so its disposal starts when the component unloads, and returns it unchanged.
Obsidian’s unload is synchronous, so nothing awaits the disposal. When the component is a Plugin, the disposal is tracked under the plugin id, and the plugin’s next instance (a PluginBase one) waits for it before it loads, as PluginBase.registerAsyncCleanup does. On any other component the disposal runs detached, and a failure is reported, never rethrown.
Import:
import { registerAsyncDisposable } from '@mnaoumov/obsidian-lib/disposable';Signature:
function registerAsyncDisposable(component: Component, asyncDisposable: TAsyncDisposable): TAsyncDisposableParameters:
| Parameter | Type | Description |
|---|---|---|
component |
Component | The component whose unload starts the disposal. |
asyncDisposable |
TAsyncDisposable | The async disposable to register. |
Returns: TAsyncDisposable — The same async disposable, for chaining.
Links to this page:
- CommandHandlerComponent
- AbortSignalComponent
- AllWindowsEventComponent
- AllWindowsStatusBarItemComponent
- AsyncErrorHandlerComponent
- BulkOperationCommitComponent
- CaseInsensitiveFileIndexComponent
- ComponentEx
- ConsoleDebugComponent
- CorePluginToggleComponent
- EmbedExtensionsComponent
- EmbeddableMarkdownEditorComponent
- FileExplorerRootMenuComponent
- GenerateMarkdownLinkDefaultParamsComponent
- IncrementalFileIndexComponent
- CallbackLayoutReadyComponent
- LayoutReadyComponent
- MenuEventRegistrarComponent
- MonkeyAroundComponent
- NotebookNavigatorMenuEventRegistrarComponent
- PluginContextComponent
- PluginGateComponent
- PluginNoticeComponent
- PluginSettingsComponentBase
- PluginSettingsTabComponent
- PluginSuggestionComponent
- PointerPositionComponent
- ReconfigurableEditorExtensionComponent
- RegistryComponent
- ReleaseNotesComponent
- RenameDeleteHandlerComponent
- RmdirGuardComponent
- SettingsFacetComponent
- SettingsMigrationComponent
- SharedComponentPoolComponent
- StyleSheetComponent
- SyntaxHighlightingComponent
- TemplatesLanguageComponent
- WorkerComponent
- WorkerPoolComponent
- WorkspaceLayoutStateComponent
- ResourceLockComponent