Skip to content

Commit 3927169

Browse files
authored
chore: add missing jsdoc to some codelabs (#2184)
1 parent 9a01aec commit 3927169

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

examples/custom-renderer-codelab/src/renderers/custom.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010

1111
import * as Blockly from 'blockly/core';
1212

13+
/**
14+
* The ConstantProvider holds rendering-related constants such as colour
15+
* and size information.
16+
*/
1317
class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
18+
/** @override */
1419
constructor() {
1520
// Set up all of the constants from the base provider.
1621
super();
@@ -81,7 +86,7 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
8186
}
8287

8388
/**
84-
* @returns Rectangular notch for use with previous and next connections.
89+
* @returns {Object} Rectangular notch for use with previous and next connections.
8590
*/
8691
makeRectangularPreviousConn() {
8792
const width = this.NOTCH_WIDTH;
@@ -90,8 +95,8 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
9095
/**
9196
* Since previous and next connections share the same shape you can define
9297
* a function to generate the path for both.
93-
* @param dir Multiplier for the horizontal direction of the path (-1 or 1)
94-
* @returns SVGPath line for use with previous and next connections.
98+
* @param {number} dir Multiplier for the horizontal direction of the path (-1 or 1)
99+
* @returns {Object} SVGPath line for use with previous and next connections.
95100
*/
96101
function makeMainPath(dir) {
97102
return Blockly.utils.svgPaths.line([
@@ -112,7 +117,7 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
112117
}
113118

114119
/**
115-
* @returns Rectangular puzzle tab for use with input and output connections.
120+
* @returns {Object} Rectangular puzzle tab for use with input and output connections.
116121
*/
117122
makeRectangularInputConn() {
118123
const width = this.TAB_WIDTH;
@@ -121,8 +126,8 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
121126
/**
122127
* Since input and output connections share the same shape you can define
123128
* a function to generate the path for both.
124-
* @param dir Multiplier for the vertical direction of the path (-1 or 1)
125-
* @returns SVGPath line for use with input and output connections.
129+
* @param {number} dir Multiplier for the vertical direction of the path (-1 or 1)
130+
* @returns {Object} SVGPath line for use with input and output connections.
126131
*/
127132
function makeMainPath(dir) {
128133
return Blockly.utils.svgPaths.line([
@@ -143,7 +148,9 @@ class CustomConstantProvider extends Blockly.blockRendering.ConstantProvider {
143148
}
144149
}
145150

151+
/** The CustomRenderer class incorporates our custom ConstantProvider. */
146152
export class CustomRenderer extends Blockly.blockRendering.Renderer {
153+
/** @override */
147154
constructor() {
148155
super();
149156
}

examples/keyboard-navigation-codelab/src/cursors/custom.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import * as Blockly from 'blockly/core';
22

3+
/** A custom cursor that skips previous and next connections. */
34
export class CustomCursor extends Blockly.Cursor {
5+
/** @override */
46
constructor() {
57
super();
68
}
79

10+
/** @override */
811
next() {
912
const curNode = this.getCurNode();
1013
if (!curNode) {
@@ -26,6 +29,7 @@ export class CustomCursor extends Blockly.Cursor {
2629
return newNode;
2730
}
2831

32+
/** @override */
2933
in() {
3034
const curNode = this.getCurNode();
3135
if (!curNode) {
@@ -43,6 +47,7 @@ export class CustomCursor extends Blockly.Cursor {
4347
return newNode;
4448
}
4549

50+
/** @override */
4651
prev() {
4752
const curNode = this.getCurNode();
4853
if (!curNode) {
@@ -64,6 +69,7 @@ export class CustomCursor extends Blockly.Cursor {
6469
return newNode;
6570
}
6671

72+
/** @override */
6773
out() {
6874
const curNode = this.getCurNode();
6975
if (!curNode) {

examples/keyboard-navigation-codelab/src/markers/custom_marker_svg.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as Blockly from 'blockly/core';
22

3+
/** A custom Marker that causes an entire block to flash when marked. */
34
class CustomMarkerSvg extends Blockly.blockRendering.MarkerSvg {
5+
/** @override */
46
constructor(workspace, constants, marker) {
57
super(workspace, constants, marker);
68
}
@@ -30,6 +32,7 @@ class CustomMarkerSvg extends Blockly.blockRendering.MarkerSvg {
3032
}
3133
}
3234

35+
/** @override */
3336
showWithBlock_(curNode) {
3437
// Get the block from the AST Node
3538
const block = curNode.getLocation();
@@ -78,11 +81,14 @@ class CustomMarkerSvg extends Blockly.blockRendering.MarkerSvg {
7881
}
7982
}
8083

84+
/** A renderer that uses our custom marker. */
8185
class CustomRenderer extends Blockly.geras.Renderer {
86+
/** @override */
8287
constructor(name) {
8388
super(name);
8489
}
8590

91+
/** @override */
8692
makeMarkerDrawer(workspace, marker) {
8793
return new CustomMarkerSvg(workspace, this.getConstants(), marker);
8894
}

0 commit comments

Comments
 (0)