Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JupyterLab

JupyterLab is the main application class. It is instantiated once and shared. The namespace for JupyterLab class statics.

Hierarchy

Index

Constructors

constructor

Properties

Private _info

_info: IInfo

Private _paths

_paths: IPaths

commandLinker

commandLinker: CommandLinker

The command linker used by the application.

commands

commands: CommandRegistry

The application command registry.

contextMenu

contextMenu: ContextMenu

The application context menu.

docRegistry

docRegistry: DocumentRegistry

The document registry instance used by the application.

name

name: string = PageConfig.getOption('appName') || 'JupyterLab'

The name of the JupyterLab application.

namespace

namespace: string = PageConfig.getOption('appNamespace') || this.name

A namespace/prefix plugins may use to denote their provenance.

registerPluginErrors

registerPluginErrors: Array<Error> = []

A list of all errors encountered when registering plugins.

restored

restored: Promise<void>

Promise that resolves when state is first restored, returning layout description.

serviceManager

serviceManager: ServiceManager

The service manager used by the application.

shell

shell: ILabShell

The application shell widget.

Notes

The shell widget is the root "container" widget for the entire application. It will typically expose an API which allows the application plugins to insert content in a variety of places.

started

started: Promise<void>

A promise which resolves after the application has started.

Notes

This promise will resolve after the start() method is called, when all the bootstrapping and shell mounting work is complete.

status

status: LabStatus = new LabStatus(this)

The application busy and dirty status signals and flags.

version

version: string = PageConfig.getOption('appVersion') || 'unknown'

The version of the JupyterLab application.

Static IInfo

IInfo: Token<IInfo> = new Token<IInfo>('@jupyterlab/application:IInfo')

The layout restorer token.

Static IPaths

IPaths: Token<IPaths> = new Token<IPaths>('@jupyterlab/application:IPaths')

The application paths dictionary token.

Accessors

info

  • The JupyterLab application information dictionary.

    Returns IInfo

paths

  • The JupyterLab application paths dictionary.

    Returns IPaths

Methods

activatePlugin

  • activatePlugin(id: string): Promise<void>
  • Activate the plugin with the given id.

    Parameters

    • id: string

      The ID of the plugin of interest.

    Returns Promise<void>

    A promise which resolves when the plugin is activated or rejects with an error if it cannot be activated.

Protected addEventListeners

  • addEventListeners(): void
  • Add the application event listeners.

    Notes

    The default implementation of this method adds listeners for 'keydown' and 'resize' events.

    A subclass may reimplement this method as needed.

    Returns void

Protected attachShell

  • attachShell(id: string): void
  • Attach the application shell to the DOM.

    Parameters

    • id: string

      The id of the host node for the shell, or ''.

      Notes

      If the id is not provided, the document body will be the host.

      A subclass may reimplement this method as needed.

    Returns void

contextMenuHitTest

  • contextMenuHitTest(test: function): HTMLElement | undefined
  • Walks up the DOM hierarchy of the target of the active contextmenu event, testing the nodes for a user-supplied funcion. This can be used to find a node on which to operate, given a context menu click.

    Parameters

    • test: function

      a function that takes an HTMLElement and returns a boolean for whether it is the element the requester is seeking.

        • (node: HTMLElement): boolean
        • Parameters

          • node: HTMLElement

          Returns boolean

    Returns HTMLElement | undefined

    an HTMLElement or undefined, if none is found.

Protected evtContextMenu

  • evtContextMenu(event: MouseEvent): void

Protected evtKeydown

  • evtKeydown(event: KeyboardEvent): void
  • A method invoked on a document 'keydown' event.

    Notes

    The default implementation of this method invokes the key down processing method of the application command registry.

    A subclass may reimplement this method as needed.

    Parameters

    • event: KeyboardEvent

    Returns void

Protected evtResize

  • evtResize(event: Event): void
  • A method invoked on a window 'resize' event.

    Notes

    The default implementation of this method updates the shell.

    A subclass may reimplement this method as needed.

    Parameters

    • event: Event

    Returns void

handleEvent

  • handleEvent(event: Event): void
  • Handle the DOM events for the application.

    Parameters

    • event: Event

      The DOM event sent to the application.

      Notes

      This method implements the DOM EventListener interface and is called in response to events registered for the application. It should not be called directly by user code.

    Returns void

hasPlugin

  • hasPlugin(id: string): boolean
  • Test whether a plugin is registered with the application.

    Parameters

    • id: string

      The id of the plugin of interest.

    Returns boolean

    true if the plugin is registered, false otherwise.

listPlugins

  • listPlugins(): string[]
  • List the IDs of the plugins registered with the application.

    Returns string[]

    A new array of the registered plugin IDs.

registerPlugin

  • registerPlugin(plugin: IPlugin<this, any>): void
  • Register a plugin with the application.

    Parameters

    • plugin: IPlugin<this, any>

      The plugin to register.

      Notes

      An error will be thrown if a plugin with the same id is already registered, or if the plugin has a circular dependency.

      If the plugin provides a service which has already been provided by another plugin, the new service will override the old service.

    Returns void

registerPluginModule

  • Register plugins from a plugin module.

    Parameters

    Returns void

registerPluginModules

  • Register the plugins from multiple plugin modules.

    Parameters

    Returns void

registerPlugins

  • registerPlugins(plugins: IPlugin<this, any>[]): void
  • Register multiple plugins with the application.

    Parameters

    • plugins: IPlugin<this, any>[]

      The plugins to register.

      Notes

      This calls registerPlugin() for each of the given plugins.

    Returns void

resolveOptionalService

  • resolveOptionalService<U>(token: Token<U>): Promise<U | null>
  • Resolve an optional service of a given type.

    Type parameters

    • U

    Parameters

    • token: Token<U>

      The token for the service type of interest.

    Returns Promise<U | null>

    A promise which resolves to an instance of the requested service, or null if it cannot be resolved.

    Notes

    Services are singletons. The same instance will be returned each time a given service token is resolved.

    If the plugin which provides the service has not been activated, resolving the service will automatically activate the plugin.

    User code will not typically call this method directly. Instead, the optional services for the user's plugins will be resolved automatically when the plugin is activated.

resolveRequiredService

  • resolveRequiredService<U>(token: Token<U>): Promise<U>
  • Resolve a required service of a given type.

    Type parameters

    • U

    Parameters

    • token: Token<U>

      The token for the service type of interest.

    Returns Promise<U>

    A promise which resolves to an instance of the requested service, or rejects with an error if it cannot be resolved.

    Notes

    Services are singletons. The same instance will be returned each time a given service token is resolved.

    If the plugin which provides the service has not been activated, resolving the service will automatically activate the plugin.

    User code will not typically call this method directly. Instead, the required services for the user's plugins will be resolved automatically when the plugin is activated.

start

  • start(options?: IStartOptions): Promise<void>
  • Start the application.

    Parameters

    • Optional options: IStartOptions

      The options for starting the application.

    Returns Promise<void>

    A promise which resolves when all bootstrapping work is complete and the shell is mounted to the DOM.

    Notes

    This should be called once by the application creator after all initial plugins have been registered.

    If a plugin fails to the load, the error will be logged and the other valid plugins will continue to be loaded.

    Bootstrapping the application consists of the following steps:

    1. Activate the startup plugins
    2. Wait for those plugins to activate
    3. Attach the shell widget to the DOM
    4. Add the application event listeners

Object literals

Static defaultInfo

defaultInfo: object

The default JupyterLab application info.

devMode

devMode: boolean = PageConfig.getOption('devMode').toLowerCase() === 'true'

filesCached

filesCached: boolean = PageConfig.getOption('cacheFiles').toLowerCase() === 'true'

mimeExtensions

mimeExtensions: undefined[] = []

deferred

deferred: object

matches

matches: undefined[] = []

patterns

patterns: undefined[] = []

disabled

disabled: object

matches

matches: undefined[] = []

patterns

patterns: undefined[] = []

Static defaultPaths

defaultPaths: object

The default JupyterLab application paths.

directories

directories: object

appSettings

appSettings: string = PageConfig.getOption('appSettingsDir')

schemas

schemas: string = PageConfig.getOption('schemasDir')

serverRoot

serverRoot: string = PageConfig.getOption('serverRoot')

static

static: string = PageConfig.getOption('staticDir')

templates

templates: string = PageConfig.getOption('templatesDir')

themes

themes: string = PageConfig.getOption('themesDir')

userSettings

userSettings: string = PageConfig.getOption('userSettingsDir')

workspaces

workspaces: string = PageConfig.getOption('workspacesDir')

urls

urls: object

app

app: string = PageConfig.getOption('appUrl')

base

base: string = PageConfig.getOption('baseUrl')

hubHost

hubHost: string = PageConfig.getOption('hubHost') || undefined

hubPrefix

hubPrefix: string = PageConfig.getOption('hubPrefix') || undefined

notFound

notFound: string = PageConfig.getOption('notFoundUrl')

settings

settings: string = PageConfig.getOption('settingsUrl')

static

static: string = PageConfig.getOption('staticUrl')

themes

themes: string = PageConfig.getOption('themesUrl')

tree

tree: string = PageConfig.getOption('treeUrl')

workspaces

workspaces: string = PageConfig.getOption('workspacesUrl')

Generated using TypeDoc