Skip to content

Commit 8f75a27

Browse files
committed
Expose execution_state in the JS package
1 parent 16162f9 commit 8f75a27

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

javascript/src/ycell.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,20 @@ export class YCodeCell
749749
}
750750
}
751751

752+
/**
753+
* The code cell's execution state.
754+
*/
755+
get execution_state(): 'running' | 'idle' {
756+
return this.ymodel.get('execution_state') ?? 'idle';
757+
}
758+
set execution_state(state: 'running' | 'idle') {
759+
if (this.ymodel.get('execution_state') !== state) {
760+
this.transact(() => {
761+
this.ymodel.set('execution_state', state);
762+
}, false);
763+
}
764+
}
765+
752766
/**
753767
* Cell outputs.
754768
*/

0 commit comments

Comments
 (0)