1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/javascripts/print.js
2020-10-22 15:41:46 -07:00

18 lines
388 B
JavaScript

import { sendEvent } from './events'
export default function () {
const printButton = document.querySelector('.js-print')
if (printButton) {
// Open the print dialog when the button is clicked
printButton.addEventListener('click', () => {
window.print()
})
}
// Track print events
window.onbeforeprint = function () {
sendEvent({ type: 'print' })
}
}