The interface for a document model that represents code.

interface ICodeModel {
    collaborative?: boolean;
    contentChanged: ISignal<ICodeModel, void>;
    defaultKernelLanguage: string;
    defaultKernelName: string;
    dirty: boolean;
    isDisposed: boolean;
    mimeType: string;
    mimeTypeChanged: ISignal<CodeEditor.IModel, IChangedArgs<string, string, string>>;
    readOnly: boolean;
    selections: IObservableMap<ITextSelection[]>;
    sharedModel: ISharedFile;
    stateChanged: ISignal<ICodeModel, IChangedArgs<any, any, string>>;
    dispose(): void;
    fromJSON(value): void;
    fromString(value): void;
    toJSON(): PartialJSONValue;
    toString(): string;

Hierarchy (view full)

Implemented by


collaborative?: boolean

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

contentChanged: ISignal<ICodeModel, 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.

dirty: boolean

The dirty state of the model.


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

isDisposed: boolean

Test whether the object has been disposed.


This property is always safe to access.

mimeType: string

A mime type of the model.


It is never null, the default mime type is text/plain.

mimeTypeChanged: ISignal<CodeEditor.IModel, IChangedArgs<string, string, string>>

A signal emitted when a property changes.

readOnly: boolean

The read-only state of the model.

The currently selected code.

sharedModel: ISharedFile

The shared notebook model.

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

A signal emitted when the model state changes.


  • Dispose of the resources held by the object.


    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