Skip to content

Commit 5b38a73

Browse files
rafaelss95jelbourn
authored andcommitted
docs(slide-toggle): add missing docs for 'MatSlideToggleChange' class (#9391)
1 parent 4c7a4f3 commit 5b38a73

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lib/slide-toggle/slide-toggle.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ export const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: any = {
5252

5353
/** Change event object emitted by a MatSlideToggle. */
5454
export class MatSlideToggleChange {
55-
source: MatSlideToggle;
56-
checked: boolean;
55+
constructor(
56+
/** The source MatSlideToggle of the event. */
57+
public source: MatSlideToggle,
58+
/** The new `checked` value of the MatSlideToggle. */
59+
public checked: boolean) { }
5760
}
5861

5962
// Boilerplate for applying mixins to MatSlideToggle.
@@ -250,11 +253,8 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
250253
* Emits a change event on the `change` output. Also notifies the FormControl about the change.
251254
*/
252255
private _emitChangeEvent() {
253-
let event = new MatSlideToggleChange();
254-
event.source = this;
255-
event.checked = this.checked;
256256
this.onChange(this.checked);
257-
this.change.emit(event);
257+
this.change.emit(new MatSlideToggleChange(this, this.checked));
258258
}
259259

260260
_onDragStart() {
@@ -353,7 +353,7 @@ class SlideToggleRenderer {
353353
updateThumbPosition(distance: number): void {
354354
this.dragPercentage = this._getDragPercentage(distance);
355355
// Calculate the moved distance based on the thumb bar width.
356-
let dragX = (this.dragPercentage / 100) * this._thumbBarWidth;
356+
const dragX = (this.dragPercentage / 100) * this._thumbBarWidth;
357357
applyCssTransform(this._thumbEl, `translate3d(${dragX}px, 0, 0)`);
358358
}
359359

0 commit comments

Comments
 (0)