本文整理汇总了TypeScript中@jupyterlab/cells.CodeCell.execute方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CodeCell.execute方法的具体用法?TypeScript CodeCell.execute怎么用?TypeScript CodeCell.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/cells.CodeCell
的用法示例。
在下文中一共展示了CodeCell.execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: runCell
/**
* Run a cell.
*/
function runCell(parent: Notebook, child: Cell, session?: IClientSession): Promise<boolean> {
switch (child.model.type) {
case 'markdown':
(child as MarkdownCell).rendered = true;
child.inputHidden = false;
break;
case 'code':
if (session) {
return CodeCell.execute(child as CodeCell, session).then(reply => {
if (child.isDisposed) {
return false;
}
if (reply && reply.content.status === 'ok') {
let content = reply.content as KernelMessage.IExecuteOkReply;
if (content.payload && content.payload.length) {
handlePayload(content, parent, child);
}
}
return reply ? reply.content.status === 'ok' : true;
}).catch(e => {
if (e.message !== 'Canceled') {
throw e;
}
return false;
});
}
(child.model as ICodeCellModel).executionCount = null;
break;
default:
break;
}
return Promise.resolve(true);
}
示例2:
execute: () => CodeCell.execute(cellWidget, session)
示例3:
matchedCells.forEach((cell) => {
cell instanceof CodeCell && CodeCell.execute(cell, session);
});