本文整理匯總了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);
});