@@ -50,13 +50,13 @@ export class PrintHook implements OnDestroy {
5050 }
5151
5252 /** Is the MediaChange event for any 'print' @media */
53- isPrintEvent ( e : MediaChange ) : Boolean {
53+ isPrintEvent ( e : MediaChange ) : boolean {
5454 return e . mediaQuery . startsWith ( PRINT ) ;
5555 }
5656
5757 /** What is the desired mqAlias to use while printing? */
5858 get printAlias ( ) : string [ ] {
59- return this . layoutConfig . printWithBreakpoints || [ ] ;
59+ return this . layoutConfig . printWithBreakpoints ?? [ ] ;
6060 }
6161
6262 /** Lookup breakpoints associated with print aliases. */
@@ -80,22 +80,22 @@ export class PrintHook implements OnDestroy {
8080 if ( this . isPrintEvent ( event ) ) {
8181 // Reset from 'print' to first (highest priority) print breakpoint
8282 bp = this . getEventBreakpoints ( event ) [ 0 ] ;
83- event . mediaQuery = bp ? bp . mediaQuery : '' ;
83+ event . mediaQuery = bp ? .mediaQuery ?? '' ;
8484 }
8585 return mergeAlias ( event , bp ) ;
8686 }
8787
8888
8989 // registeredBeforeAfterPrintHooks tracks if we registered the `beforeprint`
9090 // and `afterprint` event listeners.
91- private registeredBeforeAfterPrintHooks : boolean = false ;
91+ private registeredBeforeAfterPrintHooks = false ;
9292
9393 // 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`
9595 // form `interceptEvents` so that printing is not stopped while the dialog
9696 // is still open. This is an extension of the `isPrinting` property on
9797 // browsers which support `beforeprint` and `afterprint` events.
98- private isPrintingBeforeAfterEvent : boolean = false ;
98+ private isPrintingBeforeAfterEvent = false ;
9999
100100 private beforePrintEventListeners : Function [ ] = [ ] ;
101101 private afterPrintEventListeners : Function [ ] = [ ] ;
@@ -141,8 +141,8 @@ export class PrintHook implements OnDestroy {
141141 }
142142
143143 /**
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
146146 */
147147 interceptEvents ( target : HookTarget ) {
148148 this . registerBeforeAfterPrintHooks ( target ) ;
@@ -152,7 +152,6 @@ export class PrintHook implements OnDestroy {
152152 if ( event . matches && ! this . isPrinting ) {
153153 this . startPrinting ( target , this . getEventBreakpoints ( event ) ) ;
154154 target . updateStyles ( ) ;
155-
156155 } else if ( ! event . matches && this . isPrinting && ! this . isPrintingBeforeAfterEvent ) {
157156 this . stopPrinting ( target ) ;
158157 target . updateStyles ( ) ;
@@ -209,13 +208,14 @@ export class PrintHook implements OnDestroy {
209208 if ( ! this . isPrinting || this . isPrintingBeforeAfterEvent ) {
210209 if ( ! event . matches ) {
211210 const bp = this . breakpoints . findByQuery ( event . mediaQuery ) ;
212- if ( bp ) { // Deactivating a breakpoint
211+ // Deactivating a breakpoint
212+ if ( bp ) {
213213 this . deactivations . push ( bp ) ;
214214 this . deactivations . sort ( sortDescendingPriority ) ;
215215 }
216216 } else if ( ! this . isPrintingBeforeAfterEvent ) {
217217 // 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
219219 // the pre-Print Activations.
220220 this . deactivations = [ ] ;
221221 }
@@ -230,11 +230,10 @@ export class PrintHook implements OnDestroy {
230230 }
231231 }
232232
233- /** Is this service currently in Print-mode ? */
233+ // Is this service currently in print mode
234234 private isPrinting = false ;
235- private queue : PrintQueue = new PrintQueue ( ) ;
235+ private queue = new PrintQueue ( ) ;
236236 private deactivations : BreakPoint [ ] = [ ] ;
237-
238237}
239238
240239// ************************************************************************
@@ -261,6 +260,7 @@ class PrintQueue {
261260 addBreakpoint ( bp : OptionalBreakPoint ) {
262261 if ( ! ! bp ) {
263262 const bpInList = this . printBreakpoints . find ( it => it . mediaQuery === bp . mediaQuery ) ;
263+
264264 if ( bpInList === undefined ) {
265265 // If this is a `printAlias` breakpoint, then append. If a true 'print' breakpoint,
266266 // register as highest priority in the queue
@@ -281,6 +281,6 @@ class PrintQueue {
281281// ************************************************************************
282282
283283/** 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 ;
286286}
0 commit comments