本文整理匯總了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([]);
});
示例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);
}),
示例3:
...codeCellIds.map((id: CellId) =>
actions.executeCell({ id, contentRef: action.payload.contentRef })