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

perf: remove duplicate function calls #773

Merged
merged 2 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/lib/core/base/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export abstract class BaseDirective implements OnDestroy, OnChanges {
* querying such as computed Display style
*/
ngOnInit() {
this._display = this._getDisplayStyle();
this._hasInitialized = true;
}

Expand Down Expand Up @@ -227,9 +226,6 @@ export abstract class BaseDirective implements OnDestroy, OnChanges {
return this._hasInitialized;
}

/** Original dom Elements CSS display style */
protected _display;

/** MediaQuery Activation Tracker */
protected _mqActivation: ResponsiveActivation;

Expand Down
9 changes: 5 additions & 4 deletions src/lib/extended/show-hide/show-hide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export class ShowHideDirective extends BaseDirective implements OnInit, OnChange
*/
protected _layoutWatcher: Subscription;

/** Original dom Elements CSS display style */
protected _display: string;

/* tslint:disable */
@Input('fxShow') set show(val) { this._cacheInput('show', val); }
@Input('fxShow.xs') set showXs(val) {this._cacheInput('showXs', val);}
Expand Down Expand Up @@ -101,11 +104,8 @@ export class ShowHideDirective extends BaseDirective implements OnInit, OnChange
@Input('fxHide.gt-sm') set hideGtSm(val) {this._cacheInput('showGtSm', negativeOf(val)); };
@Input('fxHide.gt-md') set hideGtMd(val) {this._cacheInput('showGtMd', negativeOf(val)); };
@Input('fxHide.gt-lg') set hideGtLg(val) {this._cacheInput('showGtLg', negativeOf(val)); };

/* tslint:enable */
/**
*
*/

constructor(monitor: MediaMonitor,
@Optional() @Self() protected layout: LayoutDirective,
protected elRef: ElementRef,
Expand Down Expand Up @@ -155,6 +155,7 @@ export class ShowHideDirective extends BaseDirective implements OnInit, OnChange
*/
ngOnInit() {
super.ngOnInit();
this._display = this._getDisplayStyle();

let value = this._getDefaultVal('show', true);
// Build _mqActivation controller
Expand Down
1 change: 0 additions & 1 deletion src/lib/flex/flex-align/flex-align.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export class FlexAlignDirective extends BaseDirective implements OnInit, OnChang
this._listenForMediaQueryChanges('align', 'stretch', (changes: MediaChange) => {
this._updateWithValue(changes.value);
});
this._updateWithValue();
}

// *********************************************
Expand Down
1 change: 0 additions & 1 deletion src/lib/flex/flex-order/flex-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export class FlexOrderDirective extends BaseDirective implements OnInit, OnChang
this._listenForMediaQueryChanges('order', '0', (changes: MediaChange) => {
this._updateWithValue(changes.value);
});
this._updateWithValue();
}

// *********************************************
Expand Down
1 change: 0 additions & 1 deletion src/lib/flex/flex/flex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class FlexDirective extends BaseDirective implements OnInit, OnChanges, O
this._listenForMediaQueryChanges('flex', '', (changes: MediaChange) => {
this._updateStyle(changes.value);
});
this._updateStyle();

if (this._container) {
// If this flex item is inside of a flex container marked with
Expand Down
1 change: 0 additions & 1 deletion src/lib/flex/layout-align/layout-align.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export class LayoutAlignDirective extends BaseDirective implements OnInit, OnCha
this._listenForMediaQueryChanges('align', 'start stretch', (changes: MediaChange) => {
this._updateWithValue(changes.value);
});
this._updateWithValue();
}

ngOnDestroy() {
Expand Down
10 changes: 2 additions & 8 deletions src/lib/flex/layout/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ export class LayoutDirective extends BaseDirective implements OnInit, OnChanges,
@Input('fxLayout.lt-md') set layoutLtMd(val) { this._cacheInput('layoutLtMd', val); };
@Input('fxLayout.lt-lg') set layoutLtLg(val) { this._cacheInput('layoutLtLg', val); };
@Input('fxLayout.lt-xl') set layoutLtXl(val) { this._cacheInput('layoutLtXl', val); };

/* tslint:enable */
/**
*
*/

constructor(monitor: MediaMonitor,
elRef: ElementRef,
styleUtils: StyleUtils) {
Expand Down Expand Up @@ -106,16 +103,13 @@ export class LayoutDirective extends BaseDirective implements OnInit, OnChanges,
this._listenForMediaQueryChanges('layout', 'row', (changes: MediaChange) => {
this._updateWithDirection(changes.value);
});
this._updateWithDirection();
}

// *********************************************
// Protected methods
// *********************************************

/**
* Validate the direction value and then update the host's inline flexbox styles
*/
/** Validate the direction value and then update the host's inline flexbox styles */
protected _updateWithDirection(value?: string) {
value = value || this._queryInput('layout') || 'row';
if (this._mqActivation) {
Expand Down