Options
All
  • Public
  • Public/Protected
  • All
Menu

Module extensionmanager-extension

Index

Variables

Variables

Const default

default: JupyterFrontEndPlugin<void> = {id: PLUGIN_ID,autoStart: true,requires: [ISettingRegistry, ITranslator],optional: [ILabShell, ILayoutRestorer, IMainMenu, ICommandPalette],activate: async (app: JupyterFrontEnd,registry: ISettingRegistry,translator: ITranslator,labShell: ILabShell | null,restorer: ILayoutRestorer | null,mainMenu: IMainMenu | null,palette: ICommandPalette | null) => {const trans = translator.load('jupyterlab');const settings = await registry.load(plugin.id);let enabled = settings.composite['enabled'] === true;const { commands, serviceManager } = app;let view: ExtensionView | undefined;const createView = () => {const v = new ExtensionView(app, serviceManager, settings, translator);v.id = 'extensionmanager.main-view';v.title.icon = extensionIcon;v.title.caption = trans.__('Extension Manager');if (restorer) {restorer.add(v, v.id);}return v;};if (enabled && labShell) {view = createView();view.node.setAttribute('role', 'region');view.node.setAttribute('aria-label',trans.__('Extension Manager section'));labShell.add(view, 'left', { rank: 1000 });}// If the extension is enabled or disabled,// add or remove it from the left area.Promise.all([app.restored, registry.load(PLUGIN_ID)]).then(([, settings]) => {settings.changed.connect(async () => {enabled = settings.composite['enabled'] === true;if (enabled && !view?.isAttached) {const accepted = await Private.showWarning(trans);if (!accepted) {void settings.set('enabled', false);return;}view = view || createView();view.node.setAttribute('role', 'region');view.node.setAttribute('aria-label',trans.__('Extension Manager section'));if (labShell) {labShell.add(view, 'left', { rank: 1000 });}} else if (!enabled && view?.isAttached) {app.commands.notifyCommandChanged(CommandIDs.toggle);view.close();}});}).catch(reason => {console.error(`Something went wrong when reading the settings.\n${reason}`);});commands.addCommand(CommandIDs.toggle, {label: trans.__('Enable Extension Manager'),execute: () => {if (registry) {void registry.set(plugin.id, 'enabled', !enabled);}},isToggled: () => enabled,isEnabled: () => serviceManager.builder.isAvailable});const category = trans.__('Extension Manager');const command = CommandIDs.toggle;if (palette) {palette.addItem({ command, category });}if (mainMenu) {mainMenu.settingsMenu.addGroup([{ command }], 100);}}}

The extension manager plugin.

Generated using TypeDoc