23 lines
614 B
TypeScript
23 lines
614 B
TypeScript
import "print-js";
|
|
|
|
const statsCSV = document.getElementById("StatsCSV");
|
|
const statsPDF = document.getElementById("StatsPDF");
|
|
|
|
if (statsCSV) {
|
|
statsCSV.addEventListener("click", () => {
|
|
window.location = statsCSV.dataset["request"] as
|
|
| Location
|
|
| (string & Location);
|
|
});
|
|
}
|
|
|
|
if (statsPDF) {
|
|
statsPDF.addEventListener("click", () => {
|
|
const canvas = document.getElementById("chart") as HTMLCanvasElement;
|
|
window.printJS({
|
|
printable: canvas.toDataURL(),
|
|
type: "image",
|
|
imageStyle: "width:100%",
|
|
});
|
|
});
|
|
}
|