Class Context<T>

An implementation of a document context.

This class is typically instantiated by the document manager.

Type Parameters

Hierarchy

  • Context

Implements

Constructors

Properties

_conflictModalIsOpen: any
_contentsModel: any
_createSaveOptions: any
_dialogs: any
_disposed: any
_factory: any
_fileChanged: any
_finishSaveAs: any

Finish a saveAs operation given a new path.

_handleError: any

Handle a save/load error with a dialog.

_isDisposed: any
_isPopulated: any
_isReady: any
_lastModifiedCheckMargin: any
_lineEnding: any
_manager: any
_maybeCheckpoint: any

Add a checkpoint the file is writable.

_maybeOverWrite: any

Handle a time conflict.

_maybeSave: any

Save a file, dealing with conflicts.

_model: any
_onFileChanged: any

Handle a change on the contents manager.

_onSessionChanged: any

Handle a change to a session property.

_opener: any
_path: any
_pathChanged: any
_populate: any

Handle an initial population.

_populatedPromise: any
_raiseConflict: any

Handle a time conflict.

_readyPromise: any
_rename: any

Rename the document.

Param

the new name for the document.

_revert: any

Revert the document contents to disk contents.

Param

call the model's initialization function after deserializing the content.

_save: any

Save the document contents to disk.

_saveState: any
_trans: any
_updateContentsModel: any

Update our contents model, without the content.

_updatePath: any
sessionContext: SessionContext

The client session object associated with the context.

translator: ITranslator
urlResolver: IRenderMime.IResolver

The url resolver for the context.

Accessors

  • get canSave(): boolean
  • Whether the document can be saved via the Contents API.

    Returns boolean

  • get contentsModel(): Omit<Contents.IModel, "content">
  • The document metadata, stored as a services contents model.

    Notes

    The contents model will be null until the context is populated. It will not have a content field.

    Returns Omit<Contents.IModel, "content">

  • get disposed(): ISignal<this, void>
  • A signal emitted when the context is disposed.

    Returns ISignal<this, void>

  • get factoryName(): string
  • Get the model factory name.

    Notes

    This is not part of the IContext API.

    Returns string

  • get isDisposed(): boolean
  • Test whether the context is disposed.

    Returns boolean

  • get isReady(): boolean
  • Whether the context is ready.

    Returns boolean

  • get lastModifiedCheckMargin(): number
  • Configurable margin used to detect document modification conflicts, in milliseconds

    Returns number

  • set lastModifiedCheckMargin(value): void
  • Configurable margin used to detect document modification conflicts, in milliseconds

    Parameters

    • value: number

    Returns void

  • get 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.

    Returns string

  • get model(): T
  • Get the model associated with the document.

    Returns T

  • get path(): string
  • The current path associated with the document.

    Returns string

  • get pathChanged(): ISignal<this, string>
  • A signal emitted when the path changes.

    Returns ISignal<this, string>

  • get ready(): Promise<void>
  • A promise that is fulfilled when the context is ready.

    Returns Promise<void>

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.

  • Delete a checkpoint for the file.

    Parameters

    • checkpointId: string

    Returns Promise<void>

  • Dispose of the resources held by the context.

    Returns void

  • Download a file.

    Returns Promise<void>

    A promise which resolves when the file has begun downloading.

  • Initialize the context.

    Parameters

    • isNew: boolean

      Whether it is a new file.

    Returns Promise<void>

    a promise that resolves upon initialization.

  • Rename the document.

    Parameters

    • newName: string

      the new name for the document.

    Returns Promise<void>

  • Restore the file to a known checkpoint state.

    Parameters

    • Optional checkpointId: string

    Returns Promise<void>

  • 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.

    It will be rejected if the user abort providing a new path.

    Returns Promise<void>

Generated using TypeDoc