I am able to iterate through the cells in a Notebook using the method below, however each cell implements ICellModel. In order to get the cell output I have cast the model to ICodeCellModel. However, what is the correct way to access the outputs of these Cells?
const extension: JupyterFrontEndPlugin<object> = {
id: "etc-jupyterlab-telemetry:plugin",
autoStart: true,
requires: [INotebookTracker],
activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => {
tracker.widgetAdded.connect((tracker: INotebookTracker, nbPanel: NotebookPanel) => {
nbPanel.revealed.then((r)=>{
nbPanel.content.widgets.forEach(
(cell: Cell<ICellModel>,
index: number,
array: readonly Cell<ICellModel>[]
) => {
console.log((cell.model as ICodeCellModel).toJSON());
})
})
});
return {};
}
};