Options
All
  • Public
  • Public/Protected
  • All
Menu

The document context object.

Type parameters

Hierarchy

  • IDisposable
    • IContext

Implemented by

Index

Properties

Readonly contentsModel

contentsModel: IModel

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 .contents attribute will always be empty.

disposed

disposed: ISignal<IContext<T>, void>

A signal emitted when the context is disposed.

fileChanged

fileChanged: ISignal<IContext<T>, IModel>

A signal emitted when the contentsModel changes.

Readonly isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

Readonly isReady

isReady: boolean

Whether the context is ready.

lastModifiedCheckMargin

lastModifiedCheckMargin: number

Configurable margin used to detect document modification conflicts, in milliseconds

Readonly localPath

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.

Readonly model

model: T

The data model for the document.

Readonly path

path: string

The current path associated with the document.

pathChanged

pathChanged: ISignal<IContext<T>, string>

A signal emitted when the path changes.

Readonly ready

ready: Promise<void>

A promise that is fulfilled when the context is ready.

saveState

saveState: ISignal<IContext<T>, SaveState>

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

Readonly sessionContext

sessionContext: ISessionContext

The session context object associated with the context.

Readonly urlResolver

urlResolver: IResolver

The url resolver for the context.

Methods

addSibling

  • addSibling(widget: Widget, options?: IOpenOptions): IDisposable
  • 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.

createCheckpoint

  • Create a checkpoint for the file.

    Returns Promise<ICheckpointModel>

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

deleteCheckpoint

  • deleteCheckpoint(checkpointID: string): Promise<void>
  • 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

  • dispose(): void
  • 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

download

  • download(): Promise<void>
  • Save the document to a different path chosen by the user.

    Returns Promise<void>

listCheckpoints

  • List available checkpoints for the file.

    Returns Promise<ICheckpointModel[]>

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

rename

  • rename(newName: string): Promise<void>
  • Rename the document.

    Parameters

    • newName: string

    Returns Promise<void>

restoreCheckpoint

  • restoreCheckpoint(checkpointID?: string): 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

  • revert(): Promise<void>
  • Revert the document contents to disk contents.

    Returns Promise<void>

save

  • save(): Promise<void>
  • Save the document contents to disk.

    Returns Promise<void>

saveAs

  • saveAs(): Promise<void>
  • Save the document to a different path chosen by the user.

    Returns Promise<void>

Generated using TypeDoc