Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 917db4e

Browse files
committed
perf: remove getDisplayStyle call from base ngOnInit
1 parent 7b8f625 commit 917db4e

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/lib/core/base/base.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export abstract class BaseDirective implements OnDestroy, OnChanges {
8080
* querying such as computed Display style
8181
*/
8282
ngOnInit() {
83-
this._display = this._getDisplayStyle();
8483
this._hasInitialized = true;
8584
}
8685

@@ -227,9 +226,6 @@ export abstract class BaseDirective implements OnDestroy, OnChanges {
227226
return this._hasInitialized;
228227
}
229228

230-
/** Original dom Elements CSS display style */
231-
protected _display;
232-
233229
/** MediaQuery Activation Tracker */
234230
protected _mqActivation: ResponsiveActivation;
235231

src/lib/extended/show-hide/show-hide.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ export class ShowHideDirective extends BaseDirective implements OnInit, OnChange
6767
*/
6868
protected _layoutWatcher: Subscription;
6969

70+
/** Original dom Elements CSS display style */
71+
protected _display: string;
72+
7073
/* tslint:disable */
7174
@Input('fxShow') set show(val) { this._cacheInput('show', val); }
7275
@Input('fxShow.xs') set showXs(val) {this._cacheInput('showXs', val);}
@@ -101,11 +104,8 @@ export class ShowHideDirective extends BaseDirective implements OnInit, OnChange
101104
@Input('fxHide.gt-sm') set hideGtSm(val) {this._cacheInput('showGtSm', negativeOf(val)); };
102105
@Input('fxHide.gt-md') set hideGtMd(val) {this._cacheInput('showGtMd', negativeOf(val)); };
103106
@Input('fxHide.gt-lg') set hideGtLg(val) {this._cacheInput('showGtLg', negativeOf(val)); };
104-
105107
/* tslint:enable */
106-
/**
107-
*
108-
*/
108+
109109
constructor(monitor: MediaMonitor,
110110
@Optional() @Self() protected layout: LayoutDirective,
111111
protected elRef: ElementRef,
@@ -155,6 +155,7 @@ export class ShowHideDirective extends BaseDirective implements OnInit, OnChange
155155
*/
156156
ngOnInit() {
157157
super.ngOnInit();
158+
this._display = this._getDisplayStyle();
158159

159160
let value = this._getDefaultVal('show', true);
160161
// Build _mqActivation controller

0 commit comments

Comments
 (0)