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


TypeScript PageConfig.getOption方法代碼示例

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


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

示例1: it

 it('should get a known option', () => {
   expect(PageConfig.getOption('bar')).to.equal('foo');
 });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:3,代碼來源:pageconfig.spec.ts

示例2: createApp

function createApp(manager: ServiceManager.IManager): void {
  // Initialize the command registry with the bindings.
  let commands = new CommandRegistry();
  let useCapture = true;

  // Setup the keydown listener for the document.
  document.addEventListener(
    'keydown',
    event => {
      commands.processKeydownEvent(event);
    },
    useCapture
  );

  let rendermime = new RenderMimeRegistry({
    initialFactories: initialFactories,
    latexTypesetter: new MathJaxTypesetter({
      url: PageConfig.getOption('mathjaxUrl'),
      config: PageConfig.getOption('mathjaxConfig')
    })
  });

  let opener = {
    open: (widget: Widget) => {
      // Do nothing for sibling widgets for now.
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let mFactory = new NotebookModelFactory({});
  let editorFactory = editorServices.factoryService.newInlineEditor;
  let contentFactory = new NotebookPanel.ContentFactory({ editorFactory });

  let wFactory = new NotebookWidgetFactory({
    name: 'Notebook',
    modelName: 'notebook',
    fileTypes: ['notebook'],
    defaultFor: ['notebook'],
    preferKernel: true,
    canStartKernel: true,
    rendermime,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  docRegistry.addModelFactory(mFactory);
  docRegistry.addWidgetFactory(wFactory);

  let notebookPath = PageConfig.getOption('notebookPath');
  let nbWidget = docManager.open(notebookPath) as NotebookPanel;
  let palette = new CommandPalette({ commands });

  const editor =
    nbWidget.content.activeCell && nbWidget.content.activeCell.editor;
  const model = new CompleterModel();
  const completer = new Completer({ editor, model });
  const connector = new KernelConnector({ session: nbWidget.session });
  const handler = new CompletionHandler({ completer, connector });

  // Set the handler's editor.
  handler.editor = editor;

  // Listen for active cell changes.
  nbWidget.content.activeCellChanged.connect((sender, cell) => {
    handler.editor = cell && cell.editor;
  });

  // Hide the widget when it first loads.
  completer.hide();

  let panel = new SplitPanel();
  panel.id = 'main';
  panel.orientation = 'horizontal';
  panel.spacing = 0;
  SplitPanel.setStretch(palette, 0);
  SplitPanel.setStretch(nbWidget, 1);
  panel.addWidget(palette);
  panel.addWidget(nbWidget);

  // Attach the panel to the DOM.
  Widget.attach(panel, document.body);
  Widget.attach(completer, document.body);

  // Handle resize events.
  window.addEventListener('resize', () => {
    panel.update();
  });

  SetupCommands(commands, palette, nbWidget, handler);
}
開發者ID:ellisonbg,項目名稱:jupyterlab,代碼行數:94,代碼來源:index.ts

示例3: isAvailable

 /**
  * Test whether the build service is available.
  */
 get isAvailable(): boolean {
   return PageConfig.getOption('buildAvailable').toLowerCase() === 'true';
 }
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:6,代碼來源:index.ts

示例4: MathJaxTypesetter

 activate: () => {
   let url = PageConfig.getOption('mathjaxUrl');
   let config = PageConfig.getOption('mathjaxConfig');
   return new MathJaxTypesetter({ url, config });
 }
開發者ID:AlbertHilb,項目名稱:jupyterlab,代碼行數:5,代碼來源:index.ts

示例5: it

 it('should use default settings', () => {
   const settings = ServerConnection.makeSettings();
   expect(settings.baseUrl).to.equal(PageConfig.getBaseUrl());
   expect(settings.wsUrl).to.equal(PageConfig.getWsUrl());
   expect(settings.token).to.equal(PageConfig.getOption('token'));
 });
開發者ID:willingc,項目名稱:jupyterlab,代碼行數:6,代碼來源:serverconnection.spec.ts

示例6: constructor

  export class NetworkError extends TypeError {
    /**
     * Create a new network error.
     */
    constructor(original: TypeError) {
      super(original.message);
      this.stack = original.stack;
    }
  }

  /**
   * The default settings.
   */
  export const defaultSettings: ServerConnection.ISettings = {
    baseUrl: PageConfig.getBaseUrl(),
    pageUrl: PageConfig.getOption('pageUrl'),
    wsUrl: PageConfig.getWsUrl(),
    token: PageConfig.getToken(),
    init: { cache: 'no-store', credentials: 'same-origin' },
    fetch: FETCH,
    Headers: HEADERS,
    Request: REQUEST,
    WebSocket: WEBSOCKET
  };
}

/**
 * The namespace for module private data.
 */
namespace Private {
  /**
開發者ID:AlbertHilb,項目名稱:jupyterlab,代碼行數:31,代碼來源:serverconnection.ts


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