Skip to content

Commit b9168fd

Browse files
committed
add-clearOutputs-method
1 parent d989856 commit b9168fd

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

javascript/src/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,11 @@ export interface ISharedCodeCell
572572
outputs: Array<nbformat.IOutput>
573573
): void;
574574

575+
/**
576+
* Clear all outputs from the cell.
577+
*/
578+
clearOutputs(): void;
579+
575580
/**
576581
* Serialize the model to JSON.
577582
*/

javascript/src/ycell.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,19 @@ export class YCodeCell
867867
);
868868
}
869869

870+
/**
871+
* Clear all outputs from the cell.
872+
*/
873+
clearOutputs(origin: any = null): void {
874+
this.transact(
875+
() => {
876+
this._youtputs.delete(0, this._youtputs.length);
877+
},
878+
false,
879+
origin
880+
);
881+
}
882+
870883
/**
871884
* Serialize the model to JSON.
872885
*/

0 commit comments

Comments
 (0)