Monday, July 21, 2025

commented out code: make a PDF

One of my least favorite lint-ish ideas is that you shouldn't have commented out code, that it's ok to hope future coders know there's useful code to be found in the repository, if they don't mind foraging like hungry raccoons through trash.

BUT, that's the way my work seems to be leaning.

Anyway, some code I am taking out but would like to have handy:

  // const a = document.createElement('a');
  // a.setAttribute('download', 'reactflow.svg');
  // console.log(dataUrl);
  // a.setAttribute('href', dataUrl);
  // a.click();

that's just a handy of making a link to trigger a download, and even after we decided to pass dataUrl to jsPdf, I could see cases where we'd want to download the graphic file directly (for instance, the option to download an SVG, when the PDFs we make can only embed PNGs, which lose the nice formatting.)

No comments:

Post a Comment