function downloadWorkspaceScreenshot(workspace) {
  workspaceToSvg_(workspace, function (datauri) {
    const a = document.createElement('a');
    a.download = 'screenshot.png';
    a.target = '_self';
    a.href = datauri;
    document.body.appendChild(a);
    a.click();
    a.parentNode.removeChild(a);
  });
}
Download a screenshot of the blocks on a Blockly workspace.
@param {!Blockly.WorkspaceSvg} workspace The Blockly workspace.