(data)
| 21 | } |
| 22 | |
| 23 | export function downloadJSON(data) { |
| 24 | try { |
| 25 | const dataString = JSON.stringify(data); |
| 26 | const dataUrl = |
| 27 | "data:text/json;charset=utf-8," + encodeURIComponent(dataString); |
| 28 | const a = document.createElement("a"); |
| 29 | document.body.insertAdjacentElement("beforeend", a); |
| 30 | a.download = "contributions.json"; |
| 31 | a.href = dataUrl; |
| 32 | a.click(); |
| 33 | document.body.removeChild(a); |
| 34 | } catch (err) { |
| 35 | console.error(err); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | export async function share(canvas) { |
| 40 | try { |