Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Context<T>

An implementation of a document context.

This class is typically instantiated by the document manager.

Type parameters

Hierarchy

  • Context

Implements

Index

Constructors

constructor

  • Construct a new document context.

    Type parameters

    Parameters

    Returns Context

Properties

Private _contentsModel

_contentsModel: any

Private _dialogs

_dialogs: any

Private _disposed

_disposed: any

Private _factory

_factory: any

Private _fileChanged

_fileChanged: any

Private _finishSaveAs

_finishSaveAs: any

Finish a saveAs operation given a new path.

Private _handleError

_handleError: any

Handle a save/load error with a dialog.

Private _isDisposed

_isDisposed: any

Private _isPopulated

_isPopulated: any

Private _isReady

_isReady: any

Private _manager

_manager: any

Private _maybeCheckpoint

_maybeCheckpoint: any

Add a checkpoint the file is writable.

Private _maybeOverWrite

_maybeOverWrite: any

Handle a time conflict.

Private _maybeSave

_maybeSave: any

Save a file, dealing with conflicts.

Private _model

_model: any

Private _modelDB

_modelDB: any

Private _onFileChanged

_onFileChanged: any

Handle a change on the contents manager.

Private _onSessionChanged

_onSessionChanged: any

Handle a change to a session property.

Private _opener

_opener: any

Private _path

_path: any

Private _pathChanged

_pathChanged: any

Private _populate

_populate: any

Handle an initial population.

Private _populatedPromise

_populatedPromise: any

Private _readyPromise

_readyPromise: any

Private _revert

_revert: any

Revert the document contents to disk contents.

param

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

Private _save

_save: any

Save the document contents to disk.

Private _saveState

_saveState: any

Private _timeConflict

_timeConflict: any

Handle a time conflict.

Private _trans

_trans: any

Private _updateContentsModel

_updateContentsModel: any

Update our contents model, without the content.

Private _useCRLF

_useCRLF: any

Readonly sessionContext

sessionContext: SessionContext

The client session object associated with the context.

Protected translator

translator: ITranslator

Readonly urlResolver

urlResolver: IResolver

The url resolver for the context.

Accessors

contentsModel

  • get contentsModel(): IModel | null
  • The current contents model associated with the document.

    Notes

    The contents model will be null until the context is populated. It will have an empty contents field.

    Returns IModel | null

disposed

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

    Returns ISignal<this, void>

factoryName

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

    Notes

    This is not part of the IContext API.

    Returns string

fileChanged

  • get fileChanged(): ISignal<this, IModel>
  • A signal emitted when the model is saved or reverted.

    Returns ISignal<this, IModel>

isDisposed

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

    Returns boolean

isReady

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

    Returns boolean

localPath

  • 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

model

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

    Returns T

path

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

    Returns string

pathChanged

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

    Returns ISignal<this, string>

ready

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

    Returns Promise<void>

saveState

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

    Returns ISignal<this, SaveState>

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

deleteCheckpoint

  • deleteCheckpoint(checkpointId: string): Promise<void>
  • Delete a checkpoint for the file.

    Parameters

    • checkpointId: string

    Returns Promise<void>

dispose

  • dispose(): void
  • Dispose of the resources held by the context.

    Returns void

download

  • download(): Promise<void>
  • Download a file.

    Returns Promise<void>

    A promise which resolves when the file has begun downloading.

initialize

  • initialize(isNew: boolean): Promise<void>
  • Initialize the context.

    Parameters

    • isNew: boolean

      Whether it is a new file.

    Returns Promise<void>

    a promise that resolves upon initialization.

listCheckpoints

restoreCheckpoint

  • restoreCheckpoint(checkpointId?: string): Promise<void>
  • Restore the file to a known checkpoint state.

    Parameters

    • Optional checkpointId: string

    Returns Promise<void>

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