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


TypeScript actions.executeCell函數代碼示例

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


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

示例1: test

 test("Informs about disconnected kernels, allows reconnection", async () => {
   const state$ = {
     value: {
       core: stateModule.makeStateRecord({
         kernelRef: "fake",
         entities: stateModule.makeEntitiesRecord({
           contents: stateModule.makeContentsRecord({
             byRef: Immutable.Map({
               fakeContent: stateModule.makeNotebookContentRecord()
             })
           }),
           kernels: stateModule.makeKernelsRecord({
             byRef: Immutable.Map({
               fake: stateModule.makeRemoteKernelRecord({
                 channels: null,
                 status: "not connected"
               })
             })
           })
         })
       }),
       app: {
         notificationSystem: { addNotification: jest.fn() }
       }
     }
   };
   const action$ = ActionsObservable.of(
     actions.executeCell({ id: "first", contentRef: "fakeContentRef" })
   );
   const responses = await executeCellEpic(action$, state$)
     .pipe(toArray())
     .toPromise();
   expect(responses).toEqual([]);
 });
開發者ID:nteract,項目名稱:nteract,代碼行數:34,代碼來源:execute.spec.ts

示例2: mergeMap

    mergeMap((action: ExecuteCell | ExecuteFocusedCell) => {
      if (action.type === actions.EXECUTE_FOCUSED_CELL) {
        const contentRef = action.payload.contentRef;
        const state = state$.value;
        const model = selectors.model(state, { contentRef });
        // If it's not a notebook, we shouldn't be here
        if (!model || model.type !== "notebook") {
          return empty();
        }

        const id = model.cellFocused;

        if (!id) {
          throw new Error("attempted to execute without an id");
        }
        return of(
          actions.executeCell({ id, contentRef: action.payload.contentRef })
        );
      }
      return of(action);
    }),
開發者ID:kelleyblackmore,項目名稱:nteract,代碼行數:21,代碼來源:execute.ts

示例3:

 ...codeCellIds.map((id: CellId) =>
   actions.executeCell({ id, contentRef: action.payload.contentRef })
開發者ID:kelleyblackmore,項目名稱:nteract,代碼行數:2,代碼來源:execute.ts


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