The document context object.

Type Parameters

Hierarchy

Implemented by

Properties

contentsModel: Omit<Contents.IModel, "content">

The document metadata, stored as a services contents model.

Notes

This will be null until the context is 'ready'. Since we only store metadata here, the content attribute is removed.

disposed: ISignal<IContext<T>, void>

A signal emitted when the context is disposed.

fileChanged: ISignal<IContext<T>, Omit<Contents.IModel, "content">>

A signal emitted when the contentsModel changes.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

isReady: boolean

Whether the context is ready.

lastModifiedCheckMargin: number

Configurable margin used to detect document modification conflicts, in milliseconds

localPath: string

The current local path associated with the document. If the document is in the default notebook file browser, this is the same as the path.

model: T

The data model for the document.

path: string

The current path associated with the document.

pathChanged: ISignal<IContext<T>, string>

A signal emitted when the path changes.

ready: Promise<void>

A promise that is fulfilled when the context is ready.

A signal emitted on the start and end of a saving operation.

sessionContext: ISessionContext

The session context object associated with the context.

urlResolver: IRenderMime.IResolver

The url resolver for the context.

Methods

  • Add a sibling widget to the document manager.

    Parameters

    • widget: Widget

      The widget to add to the document manager.

    • Optional options: IOpenOptions

      The desired options for adding the sibling.

    Returns IDisposable

    A disposable used to remove the sibling if desired.

    Notes

    It is assumed that the widget has the same model and context as the original widget.

  • Create a checkpoint for the file.

    Returns Promise<ICheckpointModel>

    A promise which resolves with the new checkpoint model when the checkpoint is created.

  • Delete a checkpoint for the file.

    Parameters

    • checkpointID: string

      The id of the checkpoint to delete.

    Returns Promise<void>

    A promise which resolves when the checkpoint is deleted.

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Save the document to a different path chosen by the user.

    Returns Promise<void>

  • List available checkpoints for the file.

    Returns Promise<ICheckpointModel[]>

    A promise which resolves with a list of checkpoint models for the file.

  • Rename the document.

    Parameters

    • newName: string

    Returns Promise<void>

  • Restore the file to a known checkpoint state.

    Parameters

    • Optional checkpointID: string

      The optional id of the checkpoint to restore, defaults to the most recent checkpoint.

    Returns Promise<void>

    A promise which resolves when the checkpoint is restored.

  • Revert the document contents to disk contents.

    Returns Promise<void>

  • Save the document contents to disk.

    Returns Promise<void>

  • Save the document to a different path chosen by the user.

    Returns Promise<void>

Generated using TypeDoc