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


TypeScript actions.setLanguageInfo函數代碼示例

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


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

示例1: mergeMap

    mergeMap(msg => {
      const c = msg.content;
      const l = c.language_info;

      const info: KernelInfo = {
        protocolVersion: c.protocol_version,
        implementation: c.implementation,
        implementationVersion: c.implementation_version,
        banner: c.banner,
        helpLinks: c.help_links,
        languageName: l.name,
        languageVersion: l.version,
        mimetype: l.mimetype,
        fileExtension: l.file_extension,
        pygmentsLexer: l.pygments_lexer,
        codemirrorMode: l.codemirror_mode,
        nbconvertExporter: l.nbconvert_exporter
      };

      return of(
        // The original action we were using
        actions.setLanguageInfo({
          langInfo: msg.content.language_info,
          kernelRef,
          contentRef
        }),
        actions.setKernelInfo({
          kernelRef,
          info
        })
      );
    })
開發者ID:kelleyblackmore,項目名稱:nteract,代碼行數:32,代碼來源:kernel-lifecycle.ts

示例2: test

  test("sets the language object", () => {
    const originalState = monocellDocument;

    const action = actions.setLanguageInfo({ langInfo: "test" });

    const state = reducers(originalState, action);
    expect(state.getIn(["notebook", "metadata", "language_info"])).toBe("test");
  });
開發者ID:kelleyblackmore,項目名稱:nteract,代碼行數:8,代碼來源:document.spec.ts

示例3: mergeMap

    mergeMap(msg => {
      const c = msg.content;
      const l = c.language_info;

      const info: KernelInfo = {
        protocolVersion: c.protocol_version,
        implementation: c.implementation,
        implementationVersion: c.implementation_version,
        banner: c.banner,
        helpLinks: c.help_links,
        languageName: l.name,
        languageVersion: l.version,
        mimetype: l.mimetype,
        fileExtension: l.file_extension,
        pygmentsLexer: l.pygments_lexer,
        codemirrorMode: l.codemirror_mode,
        nbconvertExporter: l.nbconvert_exporter
      };

      let result;
      if (!c.protocol_version.startsWith("5")) {
        result = [
          actions.launchKernelFailed({
            kernelRef,
            contentRef,
            error: new Error(
              "The kernel that you are attempting to launch does not support the latest version (v5) of the messaging protocol."
            )
          })
        ];
      } else {
        result = [
          // The original action we were using
          actions.setLanguageInfo({
            langInfo: msg.content.language_info,
            kernelRef,
            contentRef
          }),
          actions.setKernelInfo({
            kernelRef,
            info
          })
        ];
      }

      return of(...result);
    })
開發者ID:nteract,項目名稱:nteract,代碼行數:47,代碼來源:kernel-lifecycle.ts


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