| 37 | } |
| 38 | |
| 39 | export async function share(canvas) { |
| 40 | try { |
| 41 | canvas.toBlob(async (blob) => { |
| 42 | navigator |
| 43 | .share({ |
| 44 | title: "GitHub Contributions", |
| 45 | text: "Check out my #GitHubContributions history over time. A free tool by @sallar and friends. https://github-contributions.vercel.app", |
| 46 | files: [ |
| 47 | new File([blob], "contributions.png", { |
| 48 | type: blob.type |
| 49 | }) |
| 50 | ] |
| 51 | }) |
| 52 | .catch(() => { |
| 53 | // do nothing |
| 54 | }); |
| 55 | }, "image/png"); |
| 56 | } catch (err) { |
| 57 | console.error(err); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | export async function copyToClipboard(canvas) { |
| 62 | if ("ClipboardItem" in window) { |