Last active
December 14, 2015 12:49
-
-
Save voronianski/5089508 to your computer and use it in GitHub Desktop.
getprinted.js - custom print method that supports crossbrowser callbacks on after & before print() is fired
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom print method plugin | |
* @param options {Object} - custom callbacks before print inited and after (onBeforePrint, onAfterPrint); | |
* | |
* (c) 2012 http://pixelhunter.me MIT Licensed | |
*/ | |
(function() { | |
var originalPrint = this.print; | |
this.getprinted = function (options) { | |
if (options && options.onBeforePrint) { | |
options.onBeforePrint(this); | |
} | |
originalPrint(); | |
if (options && options.onAfterPrint) { | |
options.onAfterPrint(this); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment