當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript extensionmanager.ExtensionView類代碼示例

本文整理匯總了TypeScript中@jupyterlab/extensionmanager.ExtensionView的典型用法代碼示例。如果您正苦於以下問題:TypeScript ExtensionView類的具體用法?TypeScript ExtensionView怎麽用?TypeScript ExtensionView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ExtensionView類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: async

  activate: async (
    app: JupyterFrontEnd,
    registry: ISettingRegistry,
    labShell: ILabShell | null,
    restorer: ILayoutRestorer | null
  ) => {
    const settings = await registry.load(plugin.id);
    let enabled = settings.composite['enabled'] === true;

    const { serviceManager, shell } = app;
    let view: ExtensionView | undefined;

    const createView = () => {
      const v = new ExtensionView(serviceManager);
      v.id = 'extensionmanager.main-view';
      v.title.iconClass = 'jp-ExtensionIcon jp-SideBar-tabIcon';
      v.title.caption = 'Extension Manager';
      if (restorer) {
        restorer.add(v, v.id);
      }
      return v;
    };

    if (enabled) {
      view = createView();
      shell.add(view, 'left', { rank: 1000 });
    }

    // If the extension is enabled or disabled,
    // add or remove it from the left area.
    void app.restored.then(() => {
      settings.changed.connect(async () => {
        enabled = settings.composite['enabled'] === true;
        if (enabled && (!view || (view && !view.isAttached))) {
          const accepted = await Private.showWarning();
          if (!accepted) {
            void settings.set('enabled', false);
            return;
          }
          view = view || createView();
          shell.add(view, 'left');
        } else if (!enabled && view && view.isAttached) {
          view.close();
        }
      });
    });

    addCommands(app, view, labShell);
  }
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:49,代碼來源:index.ts

示例2: async

  activate: async (
    app: JupyterLab,
    registry: ISettingRegistry,
    restorer: ILayoutRestorer,
    router: IRouter
  ) => {
    const settings = await registry.load(plugin.id);
    let enabled = settings.composite['enabled'] === true;

    const { shell, serviceManager } = app;
    const view = new ExtensionView(serviceManager);

    view.id = 'extensionmanager.main-view';
    view.title.label = 'Extensions';
    restorer.add(view, view.id);

    if (enabled) {
      shell.addToLeftArea(view);
    }

    // If the extension is enabled or disabled,
    // add or remove it from the left area.
    app.restored.then(() => {
      settings.changed.connect(async () => {
        enabled = settings.composite['enabled'] === true;
        if (enabled && !view.isAttached) {
          const accepted = await Private.showWarning();
          if (!accepted) {
            settings.set('enabled', false);
            return;
          }
          shell.addToLeftArea(view);
        } else if (!enabled && view.isAttached) {
          view.close();
        }
      });
    });

    addCommands(app, view);
  }
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:40,代碼來源:index.ts

示例3: if

 settings.changed.connect(async () => {
   enabled = settings.composite['enabled'] === true;
   if (enabled && !view.isAttached) {
     const accepted = await Private.showWarning();
     if (!accepted) {
       settings.set('enabled', false);
       return;
     }
     shell.addToLeftArea(view);
   } else if (!enabled && view.isAttached) {
     view.close();
   }
 });
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:13,代碼來源:index.ts

示例4: createView

 settings.changed.connect(async () => {
   enabled = settings.composite['enabled'] === true;
   if (enabled && (!view || (view && !view.isAttached))) {
     const accepted = await Private.showWarning();
     if (!accepted) {
       void settings.set('enabled', false);
       return;
     }
     view = view || createView();
     shell.add(view, 'left');
   } else if (!enabled && view && view.isAttached) {
     view.close();
   }
 });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:14,代碼來源:index.ts


注:本文中的@jupyterlab/extensionmanager.ExtensionView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。