# Class: `SingleWidgetApp` [@jupyterlite/application](../modules/jupyterlite_application.md).SingleWidgetApp App is the main application class. It is instantiated once and shared. ## Hierarchy - `JupyterFrontEnd`<[`ISingleWidgetShell`](../modules/jupyterlite_application.md#isinglewidgetshell)\> ↳ **``SingleWidgetApp``** ## Constructors ### `constructor` > > **`new SingleWidgetApp`**(`options?`) Construct a new SingleWidgetApp object. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `options` | [`IOptions`](../interfaces/jupyterlite_application.SingleWidgetApp.IOptions.md) | The instantiation options for an application. | #### Overrides JupyterFrontEnd<ISingleWidgetShell\>.constructor #### Defined in [packages/application/src/singleWidgetApp.ts:25](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L25) ## Properties ### `commandLinker` > > `Readonly` **`commandLinker`**: `CommandLinker` The command linker used by the application. #### Inherited from JupyterFrontEnd.commandLinker #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:50 ### `commands` > > `Readonly` **`commands`**: `CommandRegistry` The application command registry. #### Inherited from JupyterFrontEnd.commands #### Defined in node_modules/@lumino/application/types/index.d.ts:32 ### `contextMenu` > > `Readonly` **`contextMenu`**: `ContextMenuSvg` The application context menu. #### Inherited from JupyterFrontEnd.contextMenu #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:54 ### `docRegistry` > > `Readonly` **`docRegistry`**: `DocumentRegistry` The document registry instance used by the application. #### Inherited from JupyterFrontEnd.docRegistry #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:58 ### `name` > > `Readonly` **`name`**: ``"Single Widget Application"`` The name of the application. #### Overrides JupyterFrontEnd.name #### Defined in [packages/application/src/singleWidgetApp.ts:40](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L40) ### `namespace` > > `Readonly` **`namespace`**: ``"Single Widget Application"`` A namespace/prefix plugins may use to denote their provenance. #### Overrides JupyterFrontEnd.namespace #### Defined in [packages/application/src/singleWidgetApp.ts:45](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L45) ### `pluginRegistry` > > `Protected` **`pluginRegistry`**: `PluginRegistry`<`any`\> Application plugin registry. #### Inherited from JupyterFrontEnd.pluginRegistry #### Defined in node_modules/@lumino/application/types/index.d.ts:283 ### `restored` > > `Readonly` **`restored`**: `Promise`<`void`\> Promise that resolves when state is first restored. #### Inherited from JupyterFrontEnd.restored #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:62 ### `serviceManager` > > `Readonly` **`serviceManager`**: `IManager` The service manager used by the application. #### Inherited from JupyterFrontEnd.serviceManager #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:66 ### `shell` > > `Readonly` **`shell`**: [`ISingleWidgetShell`](../modules/jupyterlite_application.md#isinglewidgetshell) 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. #### Inherited from JupyterFrontEnd.shell #### Defined in node_modules/@lumino/application/types/index.d.ts:45 ### `status` > > `Readonly` **`status`**: `LabStatus` The application busy and dirty status signals and flags. #### Defined in [packages/application/src/singleWidgetApp.ts:50](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L50) ### `version` > > `Readonly` **`version`**: `string` The version of the application. #### Overrides JupyterFrontEnd.version #### Defined in [packages/application/src/singleWidgetApp.ts:55](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L55) ## Accessors ### `deferredPlugins` > > `get` **`deferredPlugins`**(): `string`[] The list of all the deferred plugins. #### Returns `string`[] #### Inherited from JupyterFrontEnd.deferredPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:49 ### `format` > > `get` **`format`**(): `U` The application form factor, e.g., `desktop` or `mobile`. #### Returns `U` #### Inherited from JupyterFrontEnd.format #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:70 > > `set` **`format`**(`format`): `void` #### Parameters | Name | Type | | :------ | :------ | | `format` | `U` | #### Returns `void` #### Inherited from JupyterFrontEnd.format #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:71 ### `formatChanged` > > `get` **`formatChanged`**(): `ISignal`<`this`, `U`\> A signal that emits when the application form factor changes. #### Returns `ISignal`<`this`, `U`\> #### Inherited from JupyterFrontEnd.formatChanged #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:75 ### `paths` > > `get` **`paths`**(): `IPaths` The JupyterLab application paths dictionary. #### Returns `IPaths` #### Defined in [packages/application/src/singleWidgetApp.ts:60](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L60) ### `started` > > `get` **`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. #### Returns `Promise`<`void`\> #### Inherited from JupyterFrontEnd.started #### Defined in node_modules/@lumino/application/types/index.d.ts:57 ## Methods ### `activateDeferredPlugins` > > **`activateDeferredPlugins`**(): `Promise`<`void`\> Activate all the deferred plugins. #### Returns `Promise`<`void`\> A promise which will resolve when each plugin is activated or rejects with an error if one cannot be activated. #### Inherited from JupyterFrontEnd.activateDeferredPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:64 ### `activatePlugin` > > **`activatePlugin`**(`id`): `Promise`<`void`\> Activate the plugin with the given ID. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `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. #### Inherited from JupyterFrontEnd.activatePlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:73 ### `addEventListeners` > > `Protected` **`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` #### Inherited from JupyterFrontEnd.addEventListeners #### Defined in node_modules/@lumino/application/types/index.d.ts:236 ### `attachShell` > > `Protected` **`attachShell`**(`id`): `void` Attach the application shell to the DOM. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `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` #### Inherited from JupyterFrontEnd.attachShell #### Defined in node_modules/@lumino/application/types/index.d.ts:226 ### `contextMenuHitTest` > > **`contextMenuHitTest`**(`fn`): `undefined` \| `HTMLElement` Walks up the DOM hierarchy of the target of the active `contextmenu` event, testing each HTMLElement ancestor for a user-supplied function. This can be used to find an HTMLElement on which to operate, given a context menu click. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `fn` | (`node`: `HTMLElement`) => `boolean` | a function that takes an `HTMLElement` and returns a boolean for whether it is the element the requester is seeking. | #### Returns `undefined` \| `HTMLElement` an HTMLElement or undefined, if none is found. #### Inherited from JupyterFrontEnd.contextMenuHitTest #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:86 ### `deactivatePlugin` > > **`deactivatePlugin`**(`id`): `Promise`<`string`[]\> Deactivate the plugin and its downstream dependents if and only if the plugin and its dependents all support `deactivate`. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The ID of the plugin of interest. | #### Returns `Promise`<`string`[]\> A list of IDs of downstream plugins deactivated with this one. #### Inherited from JupyterFrontEnd.deactivatePlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:82 ### `deregisterPlugin` > > **`deregisterPlugin`**(`id`, `force?`): `void` Deregister a plugin with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The ID of the plugin of interest. | | `force?` | `boolean` | Whether to deregister the plugin even if it is active. | #### Returns `void` #### Inherited from JupyterFrontEnd.deregisterPlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:90 ### `evtContextMenu` > > `Protected` **`evtContextMenu`**(`event`): `void` A method invoked on a document `'contextmenu'` event. #### Parameters | Name | Type | | :------ | :------ | | `event` | `MouseEvent` | #### Returns `void` #### Inherited from JupyterFrontEnd.evtContextMenu #### Defined in node_modules/@jupyterlab/application/lib/frontend.d.ts:90 ### `evtKeydown` > > `Protected` **`evtKeydown`**(`event`): `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 | Name | Type | | :------ | :------ | | `event` | `KeyboardEvent` | #### Returns `void` #### Inherited from JupyterFrontEnd.evtKeydown #### Defined in node_modules/@lumino/application/types/index.d.ts:246 ### `evtKeyup` > > `Protected` **`evtKeyup`**(`event`): `void` A method invoked on a document `'keyup'` event. #### Notes The default implementation of this method invokes the key up processing method of the application command registry. A subclass may reimplement this method as needed. #### Parameters | Name | Type | | :------ | :------ | | `event` | `KeyboardEvent` | #### Returns `void` #### Inherited from JupyterFrontEnd.evtKeyup #### Defined in node_modules/@lumino/application/types/index.d.ts:256 ### `evtResize` > > `Protected` **`evtResize`**(`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 | Name | Type | | :------ | :------ | | `event` | `Event` | #### Returns `void` #### Inherited from JupyterFrontEnd.evtResize #### Defined in node_modules/@lumino/application/types/index.d.ts:279 ### `getPluginDescription` > > **`getPluginDescription`**(`id`): `string` Get a plugin description. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The ID of the plugin of interest. | #### Returns `string` The plugin description. #### Inherited from JupyterFrontEnd.getPluginDescription #### Defined in node_modules/@lumino/application/types/index.d.ts:98 ### `handleEvent` > > **`handleEvent`**(`event`): `void` Handle the DOM events for the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `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` #### Inherited from JupyterFrontEnd.handleEvent #### Defined in node_modules/@lumino/application/types/index.d.ts:215 ### `hasPlugin` > > **`hasPlugin`**(`id`): `boolean` Test whether a plugin is registered with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The ID of the plugin of interest. | #### Returns `boolean` `true` if the plugin is registered, `false` otherwise. #### Inherited from JupyterFrontEnd.hasPlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:106 ### `isPluginActivated` > > **`isPluginActivated`**(`id`): `boolean` Test whether a plugin is activated with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The ID of the plugin of interest. | #### Returns `boolean` `true` if the plugin is activated, `false` otherwise. #### Inherited from JupyterFrontEnd.isPluginActivated #### Defined in node_modules/@lumino/application/types/index.d.ts:114 ### `listPlugins` > > **`listPlugins`**(): `string`[] List the IDs of the plugins registered with the application. #### Returns `string`[] A new array of the registered plugin IDs. #### Inherited from JupyterFrontEnd.listPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:120 ### `registerPlugin` > > **`registerPlugin`**(`plugin`): `void` Register a plugin with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `plugin` | `IPlugin`<[`SingleWidgetApp`](jupyterlite_application.SingleWidgetApp-1.md), `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` #### Inherited from JupyterFrontEnd.registerPlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:133 ### `registerPluginModule` > > **`registerPluginModule`**(`mod`): `void` Register plugins from a plugin module. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `mod` | [`IPluginModule`](../interfaces/jupyterlite_application.SingleWidgetApp.IPluginModule.md) | The plugin module to register. | #### Returns `void` #### Defined in [packages/application/src/singleWidgetApp.ts:94](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L94) ### `registerPluginModules` > > **`registerPluginModules`**(`mods`): `void` Register the plugins from multiple plugin modules. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `mods` | [`IPluginModule`](../interfaces/jupyterlite_application.SingleWidgetApp.IPluginModule.md)[] | The plugin modules to register. | #### Returns `void` #### Defined in [packages/application/src/singleWidgetApp.ts:117](https://github.com/jupyterlite/jupyterlite/blob/bcc7ac7/packages/application/src/singleWidgetApp.ts#L117) ### `registerPlugins` > > **`registerPlugins`**(`plugins`): `void` Register multiple plugins with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `plugins` | `IPlugin`<[`SingleWidgetApp`](jupyterlite_application.SingleWidgetApp-1.md), `any`\>[] | The plugins to register. #### Notes This calls `registerPlugin()` for each of the given plugins. | #### Returns `void` #### Inherited from JupyterFrontEnd.registerPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:142 ### `resolveOptionalService` > > **`resolveOptionalService`**<`U`\>(`token`): `Promise`<``null`` \| `U`\> Resolve an optional service of a given type. #### Type parameters | Name | | :------ | | `U` | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `token` | `Token`<`U`\> | The token for the service type of interest. | #### Returns `Promise`<``null`` \| `U`\> 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. #### Inherited from JupyterFrontEnd.resolveOptionalService #### Defined in node_modules/@lumino/application/types/index.d.ts:162 ### `resolveRequiredService` > > **`resolveRequiredService`**<`U`\>(`token`): `Promise`<`U`\> Resolve a required service of a given type. #### Type parameters | Name | | :------ | | `U` | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `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. #### Inherited from JupyterFrontEnd.resolveRequiredService #### Defined in node_modules/@lumino/application/types/index.d.ts:182 ### `start` > > **`start`**(`options?`): `Promise`<`void`\> Start the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `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 #### Inherited from JupyterFrontEnd.start #### Defined in node_modules/@lumino/application/types/index.d.ts:204