MCPcopy
hub / github.com/RaspberryPiFoundation/blockly / allDeveloperVariables

Function allDeveloperVariables

packages/blockly/core/variables.ts:79–93  ·  view source on GitHub ↗
(workspace: Workspace)

Source from the content-addressed store, hash-verified

77 * @returns A list of non-duplicated variable names.
78 */
79export function allDeveloperVariables(workspace: Workspace): string[] {
80 const blocks = workspace.getAllBlocks(false);
81 const variables = new Set<string>();
82 for (let i = 0, block; (block = blocks[i]); i++) {
83 const getDeveloperVariables = block.getDeveloperVariables;
84 if (getDeveloperVariables) {
85 const devVars = getDeveloperVariables();
86 for (let j = 0; j < devVars.length; j++) {
87 variables.add(devVars[j]);
88 }
89 }
90 }
91 // Convert the set into a list.
92 return Array.from(variables.values());
93}
94
95/**
96 * Construct the elements (blocks and button) required by the flyout for the

Callers

nothing calls this directly

Calls 3

fromMethod · 0.80
addMethod · 0.65
getAllBlocksMethod · 0.45

Tested by

no test coverage detected