# jquery-printevents

> This plugin publishes jQuery events before and after print

Latest version **1.0.0** (published 2019-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install jquery-printevents
pnpm add jquery-printevents
yarn add jquery-printevents
bun add jquery-printevents
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-03 |
| First published | 2019-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Kevin Warrington |
| Maintainers | dubbs |
| Keywords | jquery, print, events, onbefore, onafter |

## Links

- npm: https://www.npmjs.com/package/jquery-printevents
- Repository: https://github.com/dubbs/jquery-printevents
- Homepage: https://github.com/dubbs/jquery-printevents#readme
- Issues: https://github.com/dubbs/jquery-printevents/issues
- npm.io page: https://npm.io/package/jquery-printevents

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-01-03

## README

# jQuery Print Events

This plugin publishes jQuery events before and after print.  It normalizes [onbeforeprint](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeprint)/[onafterprint](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint) and [window.matchMedia](https://developer.mozilla.org/en/docs/Web/API/Window/matchMedia) using techniques described in this [article](https://www.tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/).

## Usage
Include dependencies:
```html
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script src="jquery.printevents.js"></script>
```
Create subscribers for the published events:
```js
$(document).on('print:before', function () {
  // run code before print
});

$(document).on('print:after', function () {
  // run code after print
});
```

---
_Source: https://npm.io/package/jquery-printevents · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
