Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 8382aa8

Browse files
committed
perf(linear-progress): Use foundation api for indeterminate and reverse property sets.
1 parent 68a2e47 commit 8382aa8

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/lib/linear-progress/linear-progress.component.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,31 @@ import { MDCLinearProgressAdapter } from './linear-progress-adapter';
1212
const { MDCLinearProgressFoundation } = require('@material/linear-progress');
1313
const MDC_PROGRESS_STYLES = require('@material/linear-progress/mdc-linear-progress.scss');
1414

15-
type UnlistenerMap = WeakMap<EventListener, Function>;
16-
1715
@Component({
1816
selector: 'mdc-linear-progress',
1917
templateUrl: './linear-progress.component.html',
2018
styles: [String(MDC_PROGRESS_STYLES)],
2119
encapsulation: ViewEncapsulation.None
2220
})
2321
export class LinearProgressComponent implements AfterViewInit {
24-
@Input() indeterminate: boolean;
25-
@Input() reversed: boolean;
22+
private _indeterminate: boolean = true;
23+
private _reversed: boolean;
24+
25+
@Input()
26+
get indeterminate() { return this._indeterminate; }
27+
set indeterminate(value) {
28+
this._foundation.setDeterminate(!value);
29+
this._indeterminate = !value;
30+
}
31+
@Input()
32+
get reversed() { return this._reversed; }
33+
set reversed(value) {
34+
this._foundation.setReverse(value);
35+
this._reversed = value;
36+
}
2637
@Input() accent: boolean;
2738
@HostBinding('attr.role') role: string = 'progressbar';
2839
@HostBinding('class.mdc-linear-progress') className: string = 'mdc-linear-progress';
29-
@HostBinding('class.mdc-linear-progress--indeterminate') get classIndeterminate(): string {
30-
return this.indeterminate ? 'mdc-linear-progress--indeterminate' : '';
31-
}
32-
@HostBinding('class.mdc-linear-progress--reversed') get classReversed(): string {
33-
return this.reversed ? 'mdc-linear-progress--reversed' : '';
34-
}
3540
@HostBinding('class.mdc-linear-progress--accent') get classAccent(): string {
3641
return this.accent ? 'mdc-linear-progress--accent' : '';
3742
}
@@ -67,6 +72,8 @@ export class LinearProgressComponent implements AfterViewInit {
6772
init: Function,
6873
setProgress: Function,
6974
setBuffer: Function,
75+
setReverse: Function,
76+
setDeterminate: Function,
7077
open: Function,
7178
close: Function
7279
} = new MDCLinearProgressFoundation(this._mdcAdapter);

0 commit comments

Comments
 (0)