Skip to content

ResourceLockComponent.lockForPath method

ResourceLockComponent › lockForPath

Locks the note at the given path on behalf of this plugin, making it read-only in every current and future MarkdownView until the lock is released. Reference-counted: balance each call with a dispose of the returned Disposable (ideally via using) or unlockForPath.

Signature:

lockForPath(params: ResourceLockComponentLockForPathParams): Disposable

Parameters:

ParameterTypeDescription
paramsResourceLockComponentLockForPathParamsLocking parameters. Its {@link ResourceLockComponentLockForPathParams.pathOrFile} and {@link ResourceLockComponentLockForPathParams.operationName} are required (the latter is shown in the unlock confirmation). Pass an {@link ResourceLockComponentLockForPathParams.abortController} to make the lock cancelable via a lock indicator's "unlock" menu, the "Unlock active note" command, or {@link requestResourceUnlockForPath}.

Returns: DisposableA Disposable that releases this lock when disposed. Disposing more than once is a no-op.