Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ca68cb

Browse files
author
Elias Cohenca
committed
perf(): Remove inside onChange event
When the callback run while changing the slider takes a certain amount of time (~50 ms or more), the inside onChange can stall resulting in many changes lost along the way while it catches up. Removing seems to have no visible side effects. It might be possible that this is due to scope.() being called right before callOnChange(), so the model is updated anyway (see in applyModel)
1 parent 40ba959 commit 6ca68cb

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

dist/rzslider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v2.4.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2015-12-30 */
4+
2016-01-13 */
55
rzslider {
66
position: relative;
77
display: inline-block;

dist/rzslider.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v2.4.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2015-12-30 */
4+
2016-01-13 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -812,10 +812,7 @@
812812
*/
813813
callOnChange: function() {
814814
if (this.options.onChange) {
815-
var self = this;
816-
$timeout(function() {
817-
self.options.onChange(self.options.id);
818-
});
815+
this.options.onChange(this.options.id);
819816
}
820817
},
821818

dist/rzslider.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rzslider.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,7 @@
816816
*/
817817
callOnChange: function() {
818818
if (this.options.onChange) {
819-
var self = this;
820-
$timeout(function() {
821-
self.options.onChange(self.options.id);
822-
});
819+
this.options.onChange(this.options.id);
823820
}
824821
},
825822

tests/spec/rz-slider-service-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ describe('rzslider - ', function() {
520520
createSlider(sliderConf);
521521

522522
slider.callOnChange();
523-
$timeout.flush();
524523
sliderConf.options.onChange.calledWith('test').should.be.true;
525524
});
526525

0 commit comments

Comments
 (0)