当前位置: 首页>>代码示例>>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;未经允许,请勿转载。