Skip to content

Commit 29e830b

Browse files
committed
Documentation
1 parent e55c385 commit 29e830b

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class BlocklyLayout extends PanelLayout {
9999
// Execute the code using the kernel, by using a static method from the
100100
// same class to make an execution request.
101101
if (this._sessionContext.hasNoKernel) {
102+
// Check whether there is a kernel
102103
showErrorMessage(
103104
'Select a valid kernel',
104105
`There is not a valid kernel selected, select one from the dropdown menu in the toolbar.

src/manager.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import * as Blockly from 'blockly';
1010
import { BlocklyRegistry } from './registry';
1111

1212
/**
13-
* BlocklyManager
13+
* BlocklyManager the manager for each document
14+
* to select the toolbox and the generator that the
15+
* user wants to use on a specific document.
1416
*/
1517
export class BlocklyManager {
1618
private _toolbox: JSONObject;
@@ -34,34 +36,64 @@ export class BlocklyManager {
3436
this._sessionContext.kernelChanged.connect(this._onKernelChanged, this);
3537
}
3638

39+
/**
40+
* Returns the selected toolbox.
41+
*/
3742
get toolbox(): JSONObject {
3843
return this._toolbox;
3944
}
4045

46+
/**
47+
* Returns the name of the selected kernel.
48+
*/
4149
get kernel(): string | undefined {
4250
return this._selectedKernel?.name || 'No kernel';
4351
}
4452

53+
/**
54+
* Returns the selected generator.
55+
*/
4556
get generator(): Blockly.Generator {
4657
return this._generator;
4758
}
4859

60+
/**
61+
* Signal triggered when the manager changes.
62+
*/
4963
get changed(): ISignal<this, BlocklyManager.Change> {
5064
return this._changed;
5165
}
5266

67+
/**
68+
* Dispose.
69+
*/
5370
dispose(): void {
5471
this._sessionContext.kernelChanged.disconnect(this._onKernelChanged, this);
5572
}
5673

74+
/**
75+
* Set the selected toolbox.
76+
*
77+
* @argument name The name of the toolbox.
78+
*/
5779
setToolbox(name: string) {
5880
this._toolbox = this._registry.toolboxes.get(name);
5981
}
6082

83+
/**
84+
* Set the selected kernel.
85+
*
86+
* @argument name The name of the kernel.
87+
*/
6188
selectKernel(name: string) {
6289
this._sessionContext.changeKernel({ name });
6390
}
6491

92+
/**
93+
* Set the selected toolbox.
94+
*
95+
* @returns the list of available kernels for Blockly
96+
*/
6597
listKernels(): { label: string; value: string }[] {
6698
const specs = this._sessionContext.specsManager.specs.kernelspecs;
6799
const list: { label: string; value: string }[] = [];
@@ -88,6 +120,14 @@ export class BlocklyManager {
88120
}
89121
}
90122

123+
/**
124+
* BlocklyManager the manager for each document
125+
* to select the toolbox and the generator that the
126+
* user wants to use on a specific document.
127+
*/
91128
export namespace BlocklyManager {
129+
/**
130+
* The argument of the signal manager changed.
131+
*/
92132
export type Change = 'toolbox' | 'kernel';
93133
}

0 commit comments

Comments
 (0)