# Class: `JupyterLiteServer` [@jupyterlite/server](../modules/jupyterlite_server.md).JupyterLiteServer Server is the main application class. It is instantiated once and shared. ## Hierarchy - `Application`<`never`\> ↳ **``JupyterLiteServer``** ## Constructors ### `constructor` > > **`new JupyterLiteServer`**(`options`) Construct a new JupyterLite object. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `options` | `IOptions`<`never`\> | The instantiation options for a JupyterLiteServer application. | #### Overrides Application<never\>.constructor #### Defined in [packages/server/src/app.ts:58](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L58) ## Properties ### `_router` > > `Private` **`_router`**: [`Router`](jupyterlite_server.Router-1.md) #### Defined in [packages/server/src/app.ts:173](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L173) ### `_serviceManager` > > `Private` **`_serviceManager`**: `ServiceManager` #### Defined in [packages/server/src/app.ts:174](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L174) ### `commands` > > `Readonly` **`commands`**: `CommandRegistry` The application command registry. #### Inherited from Application.commands #### Defined in node_modules/@lumino/application/types/index.d.ts:128 ### `contextMenu` > > `Readonly` **`contextMenu`**: `ContextMenu` The application context menu. #### Inherited from Application.contextMenu #### Defined in node_modules/@lumino/application/types/index.d.ts:132 ### `name` > > `Readonly` **`name`**: ``"JupyterLite Server"`` The name of the application. #### Defined in [packages/server/src/app.ts:75](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L75) ### `namespace` > > `Readonly` **`namespace`**: ``"JupyterLite Server"`` A namespace/prefix plugins may use to denote their provenance. #### Defined in [packages/server/src/app.ts:80](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L80) ### `shell` > > `Readonly` **`shell`**: `never` 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 Application.shell #### Defined in node_modules/@lumino/application/types/index.d.ts:141 ### `version` > > `Readonly` **`version`**: ``"unknown"`` The version of the application. #### Defined in [packages/server/src/app.ts:85](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L85) ## Accessors ### `deferredPlugins` > > `get` **`deferredPlugins`**(): `string`[] The list of all the deferred plugins. #### Returns `string`[] #### Inherited from Application.deferredPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:293 ### `router` > > `get` **`router`**(): [`Router`](jupyterlite_server.Router-1.md) Get the underlying `Router` instance. #### Returns [`Router`](jupyterlite_server.Router-1.md) #### Defined in [packages/server/src/app.ts:90](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L90) ### `serviceManager` > > `get` **`serviceManager`**(): `ServiceManager` Get the underlying lite service manager for this app. #### Returns `ServiceManager` #### Defined in [packages/server/src/app.ts:97](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L97) ### `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 Application.started #### Defined in node_modules/@lumino/application/types/index.d.ts:149 ## 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 Application.activateDeferredPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:300 ### `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 Application.activatePlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:218 ### `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 Application.addEventListeners #### Defined in node_modules/@lumino/application/types/index.d.ts:332 ### `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 For this server application there is no shell to attach | #### Returns `void` #### Overrides Application.attachShell #### Defined in [packages/server/src/app.ts:125](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L125) ### `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 Application.deactivatePlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:227 ### `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 Application.deregisterPlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:209 ### `evtContextMenu` > > `Protected` **`evtContextMenu`**(`event`): `void` A method invoked on a document `'contextmenu'` event. #### Notes The default implementation of this method opens the application `contextMenu` at the current mouse position. If the application context menu has no matching content *or* if the shift key is pressed, the default browser context menu will be opened instead. A subclass may reimplement this method as needed. #### Parameters | Name | Type | | :------ | :------ | | `event` | `PointerEvent` | #### Returns `void` #### Inherited from Application.evtContextMenu #### Defined in node_modules/@lumino/application/types/index.d.ts:356 ### `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 Application.evtKeydown #### Defined in node_modules/@lumino/application/types/index.d.ts:342 ### `evtResize` > > `Protected` **`evtResize`**(`event`): `void` A method invoked on a window `'resize'` event. #### Notes For this server application there is no shell to update #### Parameters | Name | Type | | :------ | :------ | | `event` | `Event` | #### Returns `void` #### Overrides Application.evtResize #### Defined in [packages/server/src/app.ts:135](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L135) ### `fetch` > > **`fetch`**(`req`, `init?`): `Promise`<`Response`\> Handle an incoming request from the client. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `req` | `RequestInfo` | The incoming request | | `init?` | ``null`` \| `RequestInit` | The optional init request | #### Returns `Promise`<`Response`\> #### Defined in [packages/server/src/app.ts:107](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L107) ### `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 Application.getPluginDescription #### Defined in node_modules/@lumino/application/types/index.d.ts:157 ### `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 Application.handleEvent #### Defined in node_modules/@lumino/application/types/index.d.ts:311 ### `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 Application.hasPlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:165 ### `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 Application.isPluginActivated #### Defined in node_modules/@lumino/application/types/index.d.ts:173 ### `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 Application.listPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:179 ### `registerPlugin` > > **`registerPlugin`**(`plugin`): `void` Register a plugin with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `plugin` | `IPlugin`<[`JupyterLiteServer`](jupyterlite_server.JupyterLiteServer-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 Application.registerPlugin #### Defined in node_modules/@lumino/application/types/index.d.ts:192 ### `registerPluginModule` > > **`registerPluginModule`**(`mod`): `void` Register plugins from a plugin module. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `mod` | [`IPluginModule`](../interfaces/jupyterlite_server.JupyterLiteServer.IPluginModule.md) | The plugin module to register. | #### Returns `void` #### Defined in [packages/server/src/app.ts:144](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L144) ### `registerPluginModules` > > **`registerPluginModules`**(`mods`): `void` Register the plugins from multiple plugin modules. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `mods` | [`IPluginModule`](../interfaces/jupyterlite_server.JupyterLiteServer.IPluginModule.md)[] | The plugin modules to register. | #### Returns `void` #### Defined in [packages/server/src/app.ts:167](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/server/src/app.ts#L167) ### `registerPlugins` > > **`registerPlugins`**(`plugins`): `void` Register multiple plugins with the application. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `plugins` | `IPlugin`<[`JupyterLiteServer`](jupyterlite_server.JupyterLiteServer-1.md), `any`\>[] | The plugins to register. #### Notes This calls `registerPlugin()` for each of the given plugins. | #### Returns `void` #### Inherited from Application.registerPlugins #### Defined in node_modules/@lumino/application/types/index.d.ts:201 ### `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 Application.resolveOptionalService #### Defined in node_modules/@lumino/application/types/index.d.ts:267 ### `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 Application.resolveRequiredService #### Defined in node_modules/@lumino/application/types/index.d.ts:247 ### `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 Application.start #### Defined in node_modules/@lumino/application/types/index.d.ts:289