MCPcopy Create free account
hub / github.com/TruthHun/BookStack / attachOnBeforePrintEvent

Function attachOnBeforePrintEvent

static/js/printThis.js:261–274  ·  view source on GitHub ↗
($iframe, beforePrintHandler)

Source from the content-addressed store, hash-verified

259
260 // attach event handler function to beforePrint event
261 function attachOnBeforePrintEvent($iframe, beforePrintHandler) {
262 var win = $iframe.get(0);
263 win = win.contentWindow || win.contentDocument || win;
264
265 if (typeof beforePrintHandler === "function") {
266 if ('matchMedia' in win) {
267 win.matchMedia('print').addListener(function(mql) {
268 if(mql.matches) beforePrintHandler();
269 });
270 } else {
271 win.onbeforeprint = beforePrintHandler;
272 }
273 }
274 }
275 attachOnBeforePrintEvent($iframe, opt.beforePrint);
276
277 setTimeout(function() {

Callers 1

printThis.jsFile · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected