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

Function domToVariables

packages/blockly/core/xml.ts:696–706  ·  view source on GitHub ↗
(xmlVariables: Element, workspace: Workspace)

Source from the content-addressed store, hash-verified

694 * @param workspace The workspace to which the variable should be added.
695 */
696export function domToVariables(xmlVariables: Element, workspace: Workspace) {
697 for (let i = 0; i < xmlVariables.children.length; i++) {
698 const xmlChild = xmlVariables.children[i];
699 const type = xmlChild.getAttribute('type');
700 const id = xmlChild.getAttribute('id');
701 const name = xmlChild.textContent;
702
703 if (!name) return;
704 workspace.getVariableMap().createVariable(name, type ?? undefined, id);
705 }
706}
707
708/** A mapping of nodeName to node for child nodes of xmlBlock. */
709interface childNodeTagMap {

Callers 1

domToWorkspaceFunction · 0.85

Calls 2

getVariableMapMethod · 0.80
createVariableMethod · 0.65

Tested by

no test coverage detected