Skip to content

Instantly share code, notes, and snippets.

@NeilHanlon
Last active December 18, 2015 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NeilHanlon/5855465 to your computer and use it in GitHub Desktop.
Save NeilHanlon/5855465 to your computer and use it in GitHub Desktop.
(function(){
// make a copy of the native window.print
var _print = this.print;
// create a new window.print
window.print = function (window) {
// if `onbeforeprint` exists, call it.
if(this.onbeforeprint) onbeforeprint(this);
// call the original `window.print`.
_print.apply(this);
// if `onafterprint` exists, call it.
if (this.onafterprint) onafterprint(this);
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment