Interface IDocumentManager

The interface for a document manager.

interface IDocumentManager {
    activateRequested: ISignal<IDocumentManager, string>;
    autosave: boolean;
    autosaveInterval: number;
    confirmClosingDocument: boolean;
    isDisposed: boolean;
    lastModifiedCheckMargin: number;
    registry: DocumentRegistry;
    renameUntitledFileOnSave: boolean;
    services: ServiceManager.IManager;
    stateChanged: ISignal<IDocumentManager, IChangedArgs<any, any, string>>;
    cloneWidget(widget): undefined | IDocumentWidget<Widget, DocumentRegistry.IModel>;
    closeAll(): Promise<void>;
    closeFile(path): Promise<void>;
    contextForWidget(widget): undefined | DocumentRegistry.Context;
    copy(fromFile, toDir): Promise<Contents.IModel>;
    createNew(path, widgetName?, kernel?): undefined | Widget;
    deleteFile(path): Promise<void>;
    dispose(): void;
    duplicate(path): Promise<Contents.IModel>;
    findWidget(path, widgetName?): undefined | IDocumentWidget<Widget, DocumentRegistry.IModel>;
    newUntitled(options): Promise<Contents.IModel>;
    open(path, widgetName?, kernel?, options?): undefined | IDocumentWidget<Widget, DocumentRegistry.IModel>;
    openOrReveal(path, widgetName?, kernel?, options?): undefined | IDocumentWidget<Widget, DocumentRegistry.IModel>;
    overwrite(oldPath, newPath): Promise<Contents.IModel>;
    rename(oldPath, newPath): Promise<Contents.IModel>;
}

Hierarchy

Implemented by

Properties

activateRequested: ISignal<IDocumentManager, string>

A signal emitted when one of the documents is activated.

autosave: boolean

Whether to autosave documents.

autosaveInterval: number

Determines the time interval for autosave in seconds.

confirmClosingDocument: boolean

Whether to ask confirmation to close a tab or not.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

lastModifiedCheckMargin: number

Defines max acceptable difference, in milliseconds, between last modified timestamps on disk and client.

The registry used by the manager.

renameUntitledFileOnSave: boolean

Whether to ask the user to rename untitled file on first manual save.

The service manager used by the manager.

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

Signal triggered when an attribute changes.

Methods

  • Create a new file and return the widget used to view it.

    Parameters

    • path: string

      The file path to create.

    • Optional widgetName: string

      The name of the widget factory to use. 'default' will use the default widget.

    • Optional kernel: Partial<Kernel.IModel>

      An optional kernel name/id to override the default.

    Returns undefined | Widget

    The created widget, or undefined.

    Notes

    This function will return undefined if a valid widget factory cannot be found.

  • Delete a file.

    Parameters

    • path: string

      The full path to the file to be deleted.

    Returns Promise<void>

    A promise which resolves when the file is deleted.

    Notes

    If there is a running session associated with the file and no other sessions are using the kernel, the session will be shut down.

  • 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

  • Rename a file or directory.

    Parameters

    • oldPath: string

      The full path to the original file.

    • newPath: string

      The full path to the new file.

    Returns Promise<Contents.IModel>

    A promise containing the new file contents model. The promise will reject if the newPath already exists. Use [[overwrite]] to overwrite a file.