Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NotebookModel

An implementation of a notebook Model.

Hierarchy

  • NotebookModel

Implements

Index

Constructors

constructor

  • Construct a new notebook model.

    Parameters

    Returns NotebookModel

Properties

Private _cells

_cells: any

Private _contentChanged

_contentChanged: any

Private _deletedCells

_deletedCells: any

Private _dirty

_dirty: any

Private _ensureMetadata

_ensureMetadata: any

Make sure we have the required metadata fields.

Private _isDisposed

_isDisposed: any

Private _isInitialized

_isInitialized: any

Private _nbformat

_nbformat: any

Private _nbformatMinor

_nbformatMinor: any

Private _onCellsChanged

_onCellsChanged: any

Handle a change in the cells list.

Private _onStateChanged

_onStateChanged: any

Private _readOnly

_readOnly: any

Private _stateChanged

_stateChanged: any

Private _trans

_trans: any

Readonly contentFactory

contentFactory: IContentFactory

The cell model factory for the notebook.

Readonly modelDB

modelDB: IModelDB

The underlying IModelDB instance in which model data is stored.

Readonly sharedModel

sharedModel: ISharedNotebook

The shared notebook model.

Accessors

cells

contentChanged

  • get contentChanged(): ISignal<this, void>
  • A signal emitted when the document content changes.

    Returns ISignal<this, void>

defaultKernelLanguage

  • get defaultKernelLanguage(): string

defaultKernelName

  • get defaultKernelName(): string
  • The default kernel name of the document.

    Returns string

deletedCells

  • get deletedCells(): string[]
  • A list of deleted cells for the notebook..

    Returns string[]

dirty

  • get dirty(): boolean
  • set dirty(newValue: boolean): void
  • The dirty state of the document.

    Returns boolean

  • The dirty state of the model.

    Notes

    This should be cleared when the document is loaded from or saved to disk.

    Parameters

    • newValue: boolean

    Returns void

isDisposed

  • get isDisposed(): boolean
  • Whether the model is disposed.

    Returns boolean

isInitialized

  • get isInitialized(): boolean
  • If the model is initialized or not.

    Returns boolean

metadata

nbformat

  • get nbformat(): number
  • The major version number of the nbformat.

    Returns number

nbformatMinor

  • get nbformatMinor(): number
  • The minor version number of the nbformat.

    Returns number

readOnly

  • get readOnly(): boolean
  • set readOnly(newValue: boolean): void
  • The read only state of the document.

    Returns boolean

  • The read-only state of the model.

    Parameters

    • newValue: boolean

    Returns void

stateChanged

  • get stateChanged(): ISignal<this, IChangedArgs<any, any, string>>
  • A signal emitted when the document state changes.

    Returns ISignal<this, IChangedArgs<any, any, string>>

Methods

dispose

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

    Returns void

fromJSON

  • fromJSON(value: INotebookContent): void
  • Deserialize the model from JSON.

    Notes

    Should emit a [contentChanged] signal.

    Parameters

    • value: INotebookContent

    Returns void

fromString

  • fromString(value: string): void
  • Deserialize the model from a string.

    Notes

    Should emit a [contentChanged] signal.

    Parameters

    • value: string

    Returns void

initialize

  • initialize(): void
  • Initialize the model with its current state.

    Notes

    Adds an empty code cell if the model is empty and clears undo state.

    Returns void

toJSON

  • toJSON(): INotebookContent
  • Serialize the model to JSON.

    Returns INotebookContent

toString

  • toString(): string
  • Serialize the model to a string.

    Returns string

Protected triggerContentChange

  • triggerContentChange(): void
  • Trigger a content changed signal.

    Returns void

Protected triggerStateChange

  • triggerStateChange(args: IChangedArgs<any, any, string>): void
  • Trigger a state change signal.

    Parameters

    Returns void

Generated using TypeDoc