@@ -50,13 +50,13 @@ export class PrintHook implements OnDestroy {
50
50
}
51
51
52
52
/** Is the MediaChange event for any 'print' @media */
53
- isPrintEvent ( e : MediaChange ) : Boolean {
53
+ isPrintEvent ( e : MediaChange ) : boolean {
54
54
return e . mediaQuery . startsWith ( PRINT ) ;
55
55
}
56
56
57
57
/** What is the desired mqAlias to use while printing? */
58
58
get printAlias ( ) : string [ ] {
59
- return this . layoutConfig . printWithBreakpoints || [ ] ;
59
+ return this . layoutConfig . printWithBreakpoints ?? [ ] ;
60
60
}
61
61
62
62
/** Lookup breakpoints associated with print aliases. */
@@ -80,22 +80,22 @@ export class PrintHook implements OnDestroy {
80
80
if ( this . isPrintEvent ( event ) ) {
81
81
// Reset from 'print' to first (highest priority) print breakpoint
82
82
bp = this . getEventBreakpoints ( event ) [ 0 ] ;
83
- event . mediaQuery = bp ? bp . mediaQuery : '' ;
83
+ event . mediaQuery = bp ? .mediaQuery ?? '' ;
84
84
}
85
85
return mergeAlias ( event , bp ) ;
86
86
}
87
87
88
88
89
89
// registeredBeforeAfterPrintHooks tracks if we registered the `beforeprint`
90
90
// and `afterprint` event listeners.
91
- private registeredBeforeAfterPrintHooks : boolean = false ;
91
+ private registeredBeforeAfterPrintHooks = false ;
92
92
93
93
// isPrintingBeforeAfterEvent is used to track if we are printing from within
94
- // a `beforeprint` event handler. This prevents the typicall `stopPrinting`
94
+ // a `beforeprint` event handler. This prevents the typical `stopPrinting`
95
95
// form `interceptEvents` so that printing is not stopped while the dialog
96
96
// is still open. This is an extension of the `isPrinting` property on
97
97
// browsers which support `beforeprint` and `afterprint` events.
98
- private isPrintingBeforeAfterEvent : boolean = false ;
98
+ private isPrintingBeforeAfterEvent = false ;
99
99
100
100
private beforePrintEventListeners : Function [ ] = [ ] ;
101
101
private afterPrintEventListeners : Function [ ] = [ ] ;
@@ -141,8 +141,8 @@ export class PrintHook implements OnDestroy {
141
141
}
142
142
143
143
/**
144
- * Prepare RxJS filter operator with partial application
145
- * @return pipeable filter predicate
144
+ * Prepare RxJS tap operator with partial application
145
+ * @return pipeable tap predicate
146
146
*/
147
147
interceptEvents ( target : HookTarget ) {
148
148
this . registerBeforeAfterPrintHooks ( target ) ;
@@ -152,7 +152,6 @@ export class PrintHook implements OnDestroy {
152
152
if ( event . matches && ! this . isPrinting ) {
153
153
this . startPrinting ( target , this . getEventBreakpoints ( event ) ) ;
154
154
target . updateStyles ( ) ;
155
-
156
155
} else if ( ! event . matches && this . isPrinting && ! this . isPrintingBeforeAfterEvent ) {
157
156
this . stopPrinting ( target ) ;
158
157
target . updateStyles ( ) ;
@@ -209,13 +208,14 @@ export class PrintHook implements OnDestroy {
209
208
if ( ! this . isPrinting || this . isPrintingBeforeAfterEvent ) {
210
209
if ( ! event . matches ) {
211
210
const bp = this . breakpoints . findByQuery ( event . mediaQuery ) ;
212
- if ( bp ) { // Deactivating a breakpoint
211
+ // Deactivating a breakpoint
212
+ if ( bp ) {
213
213
this . deactivations . push ( bp ) ;
214
214
this . deactivations . sort ( sortDescendingPriority ) ;
215
215
}
216
216
} else if ( ! this . isPrintingBeforeAfterEvent ) {
217
217
// Only clear deactivations if we aren't printing from a `beforeprint` event.
218
- // Otherwise this will clear before `stopPrinting()` is called to restore
218
+ // Otherwise, this will clear before `stopPrinting()` is called to restore
219
219
// the pre-Print Activations.
220
220
this . deactivations = [ ] ;
221
221
}
@@ -230,11 +230,10 @@ export class PrintHook implements OnDestroy {
230
230
}
231
231
}
232
232
233
- /** Is this service currently in Print-mode ? */
233
+ // Is this service currently in print mode
234
234
private isPrinting = false ;
235
- private queue : PrintQueue = new PrintQueue ( ) ;
235
+ private queue = new PrintQueue ( ) ;
236
236
private deactivations : BreakPoint [ ] = [ ] ;
237
-
238
237
}
239
238
240
239
// ************************************************************************
@@ -261,6 +260,7 @@ class PrintQueue {
261
260
addBreakpoint ( bp : OptionalBreakPoint ) {
262
261
if ( ! ! bp ) {
263
262
const bpInList = this . printBreakpoints . find ( it => it . mediaQuery === bp . mediaQuery ) ;
263
+
264
264
if ( bpInList === undefined ) {
265
265
// If this is a `printAlias` breakpoint, then append. If a true 'print' breakpoint,
266
266
// register as highest priority in the queue
@@ -281,6 +281,6 @@ class PrintQueue {
281
281
// ************************************************************************
282
282
283
283
/** Only support intercept queueing if the Breakpoint is a print @media query */
284
- function isPrintBreakPoint ( bp : OptionalBreakPoint ) {
285
- return bp ? bp . mediaQuery . startsWith ( PRINT ) : false ;
284
+ function isPrintBreakPoint ( bp : OptionalBreakPoint ) : boolean {
285
+ return bp ? .mediaQuery . startsWith ( PRINT ) ?? false ;
286
286
}
0 commit comments