Skip to content

Commit 63af24c

Browse files
author
Thomas Grainger
committed
replace _ private variables with private namespace
1 parent 56646e8 commit 63af24c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/js/bootstrap-switch.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,17 @@ class BootstrapSwitch {
344344
if (width < handleWidth) { return handleWidth; }
345345
return width;
346346
});
347-
this._handleWidth = this.$on.outerWidth();
348-
this._labelWidth = this.$label.outerWidth();
349-
this.$container.width((this._handleWidth * 2) + this._labelWidth);
350-
return this.$wrapper.width(this._handleWidth + this._labelWidth);
347+
this.privateHandleWidth = this.$on.outerWidth();
348+
this.privateLabelWidth = this.$label.outerWidth();
349+
this.$container.width((this.privateHandleWidth * 2) + this.privateLabelWidth);
350+
return this.$wrapper.width(this.privateHandleWidth + this.privateLabelWidth);
351351
}
352352

353353
_containerPosition(state = this.ope) {
354354
this.$container.css('margin-left', () => {
355-
const values = [0, `-${this._handleWidth}px`];
355+
const values = [0, `-${this.privateHandleWidth}px`];
356356
if (this.options.indeterminate) {
357-
return `-${this._handleWidth / 2}px`;
357+
return `-${this.privateHandleWidth / 2}px`;
358358
}
359359
if (state) {
360360
if (this.options.inverse) {
@@ -489,7 +489,7 @@ class BootstrapSwitch {
489489
if (dragStart == null) { return; }
490490
const difference = (event.pageX || event.originalEvent.touches[0].pageX) - dragStart;
491491
event.preventDefault();
492-
if (difference < -this._handleWidth || difference > 0) { return; }
492+
if (difference < -this.privateHandleWidth || difference > 0) { return; }
493493
dragEnd = difference;
494494
this.$container.css('margin-left', `${dragEnd}px`);
495495
},
@@ -501,7 +501,7 @@ class BootstrapSwitch {
501501
this.$wrapper.addClass(this._getClass('animate'));
502502
}
503503
if (dragEnd) {
504-
const state = dragEnd > -(this._handleWidth / 2);
504+
const state = dragEnd > -(this.privateHandleWidth / 2);
505505
dragEnd = false;
506506
this.state(this.options.inverse ? !state : state);
507507
} else {

0 commit comments

Comments
 (0)