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


TypeScript PageConfig.getBaseUrl方法代碼示例

本文整理匯總了TypeScript中@jupyterlab/coreutils.PageConfig.getBaseUrl方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PageConfig.getBaseUrl方法的具體用法?TypeScript PageConfig.getBaseUrl怎麽用?TypeScript PageConfig.getBaseUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@jupyterlab/coreutils.PageConfig的用法示例。


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

示例1:

 manager.ready.then(() => {
   const specs = manager.specs;
   if (!specs) {
     return;
   }
   let baseUrl = PageConfig.getBaseUrl();
   for (let name in specs.kernelspecs) {
     let displayName = specs.kernelspecs[name].display_name;
     let rank = name === specs.default ? 0 : Infinity;
     let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
     if (kernelIconUrl) {
       let index = kernelIconUrl.indexOf('kernelspecs');
       kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
     }
     launcher.add({
       displayName,
       category: 'Console',
       name,
       iconClass: 'jp-CodeConsoleIcon',
       callback,
       rank,
       kernelIconUrl
     });
   }
 });
開發者ID:SimonBiggs,項目名稱:jupyterlab,代碼行數:25,代碼來源:index.ts

示例2: DisposableSet

 const onSpecsChanged = () => {
   if (disposables) {
     disposables.dispose();
     disposables = null;
   }
   const specs = manager.specs;
   if (!specs) {
     return;
   }
   disposables = new DisposableSet();
   let baseUrl = PageConfig.getBaseUrl();
   for (let name in specs.kernelspecs) {
     let rank = name === specs.default ? 0 : Infinity;
     let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
     if (kernelIconUrl) {
       let index = kernelIconUrl.indexOf('kernelspecs');
       kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
     }
     disposables.add(
       launcher.add({
         command: CommandIDs.create,
         args: { isLauncher: true, kernelPreference: { name } },
         category: 'Console',
         rank,
         kernelIconUrl
       })
     );
   }
 };
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:29,代碼來源:index.ts

示例3: it

 it('should use default settings', () => {
   let settings = ServerConnection.makeSettings();
   expect(settings.baseUrl).to.be(PageConfig.getBaseUrl());
   expect(settings.wsUrl).to.be(PageConfig.getWsUrl());
   expect(settings.user).to.be('');
   expect(settings.password).to.be('');
   expect(settings.withCredentials).to.be(false);
   expect(settings.timeout).to.be(0);
   expect(settings.token).to.be(PageConfig.getOption('token'));
   expect(Object.keys(settings.requestHeaders).length).to.be(0);
 });
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:11,代碼來源:serverconnection.spec.ts

示例4: makeSettings

 function makeSettings(options: Partial<ServerConnection.ISettings> = {}): ServerConnection.ISettings {
   let baseUrl = options.baseUrl || PageConfig.getBaseUrl();
   return {
     baseUrl,
     wsUrl: options.wsUrl || PageConfig.getWsUrl(baseUrl),
     user: options.user || '',
     password: options.password || '',
     withCredentials: !!options.withCredentials,
     timeout: options.timeout || 0,
     token: options.token || PageConfig.getOption('token'),
     requestHeaders: { ...options.requestHeaders || {} },
     xhrFactory: options.xhrFactory || xhrFactory,
     wsFactory: options.wsFactory || wsFactory
   };
 }
開發者ID:charnpreetsingh185,項目名稱:jupyterlab,代碼行數:15,代碼來源:serverconnection.ts

示例5: setApi

  private setApi() {
    let baseUrl;

    if (this.api) {
      return;
    }

    try {
      const coreutils = require('@jupyterlab/coreutils');
      coreutils.PageConfig.getOption('pageUrl');
      baseUrl = coreutils.PageConfig.getBaseUrl();
    } catch (e) {
      baseUrl = `${window.location.origin}/`;
    }

    this.api = new BeakerXApi(baseUrl);
  }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:17,代碼來源:comm.ts

示例6:

    services.ready.then(() => {
      const specs = services.specs;
      const baseUrl = PageConfig.getBaseUrl();

      for (let name in specs.kernelspecs) {
        let rank = name === specs.default ? 0 : Infinity;
        let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
        if (kernelIconUrl) {
          let index = kernelIconUrl.indexOf('kernelspecs');
          kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
        }
        launcher.add({
          command: CommandIDs.createNew,
          args: { isLauncher: true, kernelName: name },
          category: 'Notebook',
          rank,
          kernelIconUrl
        });
      }
    });
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:20,代碼來源:index.ts

示例7: prepareImageSrc

  private prepareImageSrc(config): string {
    let baseUrl;

    if (config.value[0] !== '.') {
      return `${ config.value }`;
    }

    try {
      const coreutils = require('@jupyterlab/coreutils');
      coreutils.PageConfig.getOption('pageUrl');
      baseUrl = coreutils.PageConfig.getBaseUrl();

    } catch (e) {
      baseUrl = `${window.location.origin}/`;
    }

    let notebookPath = `${ baseUrl }${ document.body.dataset.notebookPath}`;

    return  '/files' + new URL(config.value, notebookPath).pathname;
  }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:20,代碼來源:ImageCellRenderer.ts

示例8: TreeWidget

    execute: () => {
      if (!widget) {
        let options = {
          baseUrl: PageConfig.getBaseUrl(),
          isLab: true,
        };
        widget = new TreeWidget(options);
        widget.update();
      }
      if (!tracker.has(widget)) {
        tracker.add(widget);
      }

      if (!widget.isAttached) {
        app.shell.addToMainArea(widget);
      } else {
        widget.update();
      }

      app.shell.activateById(widget.id);
    }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:21,代碼來源:tree.ts

示例9:

 services.ready.then(() => {
   let specs = services.specs;
   let baseUrl = PageConfig.getBaseUrl();
   for (let name in specs.kernelspecs) {
     let displayName = specs.kernelspecs[name].display_name;
     let rank = name === specs.default ? 0 : Infinity;
     let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
     if (kernelIconUrl) {
       let index = kernelIconUrl.indexOf('kernelspecs');
       kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
     }
     launcher.add({
       displayName,
       category: 'Notebook',
       name,
       iconClass: 'jp-NotebookRunningIcon',
       callback,
       rank,
       kernelIconUrl
     });
   }
 });
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:22,代碼來源:index.ts

示例10:

 manager.ready.then(() => {
   const specs = manager.specs;
   if (!specs) {
     return;
   }
   let baseUrl = PageConfig.getBaseUrl();
   for (let name in specs.kernelspecs) {
     let rank = name === specs.default ? 0 : Infinity;
     let kernelIconUrl = specs.kernelspecs[name].resources['logo-64x64'];
     if (kernelIconUrl) {
       let index = kernelIconUrl.indexOf('kernelspecs');
       kernelIconUrl = baseUrl + kernelIconUrl.slice(index);
     }
     launcher.add({
       command: CommandIDs.create,
       args: { isLauncher: true, kernelPreference: { name } },
       category: 'Console',
       rank,
       kernelIconUrl
     });
   }
 });
開發者ID:SylvainCorlay,項目名稱:jupyterlab,代碼行數:22,代碼來源:index.ts


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