Interface INotebookModel

The definition of a model object for a notebook widget.

interface INotebookModel {
    cells: CellList;
    collaborative?: boolean;
    contentChanged: ISignal<INotebookModel, void>;
    defaultKernelLanguage: string;
    defaultKernelName: string;
    deletedCells: string[];
    dirty: boolean;
    isDisposed: boolean;
    metadata: INotebookMetadata;
    metadataChanged: ISignal<INotebookModel, IMapChange<any>>;
    nbformat: number;
    nbformatMinor: number;
    readOnly: boolean;
    sharedModel: ISharedNotebook;
    stateChanged: ISignal<INotebookModel, IChangedArgs<any, any, string>>;
    deleteMetadata(key): void;
    dispose(): void;
    fromJSON(value): void;
    fromString(value): void;
    getMetadata(key): any;
    setMetadata(key, value): void;
    toJSON(): PartialJSONValue;
    toString(): string;
}

Hierarchy (view full)

Implemented by

Properties

cells: CellList

The list of cells in the notebook.

collaborative?: boolean

Whether this document model supports collaboration when the collaborative flag is enabled globally. Defaults to false.

contentChanged: ISignal<INotebookModel, void>

A signal emitted when the document content changes.

defaultKernelLanguage: string

The default kernel language of the document.

defaultKernelName: string

The default kernel name of the document.

deletedCells: string[]

The array of deleted cells since the notebook was last run.

dirty: boolean

The dirty state of the model.

Notes

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

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

The metadata associated with the notebook.

Notes

This is a copy of the metadata. Changing a part of it won't affect the model. As this returns a copy of all metadata, it is advised to use getMetadata to speed up the process of getting a single key.

metadataChanged: ISignal<INotebookModel, IMapChange<any>>

Signal emitted when notebook metadata changes.

nbformat: number

The major version number of the nbformat.

nbformatMinor: number

The minor version number of the nbformat.

readOnly: boolean

The read-only state of the model.

sharedModel: ISharedNotebook

Shared model

stateChanged: ISignal<INotebookModel, IChangedArgs<any, any, string>>

A signal emitted when the model state changes.

Methods

  • 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

  • Deserialize the model from JSON.

    Notes

    Should emit a [contentChanged] signal.

    Parameters

    • value: ReadonlyPartialJSONValue

    Returns void

  • Deserialize the model from a string.

    Notes

    Should emit a [contentChanged] signal.

    Parameters

    • value: string

    Returns void

  • Serialize the model to a string.

    Returns string