Reliably detect when the user prints. A better solution for beforeprint
/afterprint
.
npm install window-on-print
const onPrint = require('window-on-print')
const unsubscribe = onPrint.before(window, () => {
console.info('user is going to print')
})
onPrint.after(window, () => {
console.info('user is has printed or aborted')
})
You may call unsubscribe()
to stop listening for events.
If you have a question, found a bug or want to propose a feature, have a look at the issues page.