In order to try to illustrate what I am inquiring about, the code below shows the number of outputs for a CodeCell. In the first console.log I am not using the model
and in the second console.log I am using the model
in order to get this length. I am trying to understand the model
concept.
What is a model
? I realize this might be an obtuse question. However, I am struggling to understand this concept, so I thought perhaps someone could shed light on it for me.
const extension: JupyterFrontEndPlugin<object> = {
id: "etc-jupyterlab-telemetry:plugin",
autoStart: true,
requires: [INotebookTracker],
activate: (app: JupyterFrontEnd, nbTracker: INotebookTracker) => {
window.nbApp = app;
console.log("JupyterLab extension etc-jupyterlab-telemetry is activated!");
nbTracker.widgetAdded.connect(async (tracker: INotebookTracker, nbPanel: NotebookPanel) => {
await nbPanel.revealed;
nbPanel.content.widgets.forEach((cell: Cell<ICellModel>) => {
if (cell.model.type === "code") {
console.log((cell as CodeCell).outputArea.widgets.length); // Not Model output
console.log((cell as CodeCell).model.outputs.length); // Model output
}
});
});
return {
};
}
};