Skip to content

Commit

Permalink
Add a cell container
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Feb 6, 2024
1 parent 773b150 commit 23f39aa
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions _extensions/pyodide/qpyodide-cell-classes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
/**
* CellContainer class for managing a collection of cells.
* @class
*/
class CellContainer {
/**
* Constructor for CellContainer.
* Initializes an empty array to store cells.
* @constructor
*/
constructor() {
this.cells = [];
}

/**
* Add a cell to the container.
* @param {BaseCell} cell - Instance of a cell (BaseCell or its subclasses).
*/
addCell(cell) {
this.cells.push(cell);
}

/**
* Execute all cells in the container.
*/
async executeAllCells() {
for (const cell of this.cells) {
await cell.executeCode();
}
}
}


/**
* BaseCell class for handling code execution using Pyodide.
* @class
Expand Down

0 comments on commit 23f39aa

Please sign in to comment.