react-slider
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "react-slider", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Slider component for React", | ||
@@ -5,0 +5,0 @@ "main": "react-slider.js", |
@@ -203,2 +203,5 @@ (function (root, factory) { | ||
// array for storing resize timeouts ids | ||
this.pendingResizeTimeouts = []; | ||
var zIndices = []; | ||
@@ -268,3 +271,3 @@ for (var i = 0; i < value.length; i++) { | ||
componentWillUnmount: function () { | ||
clearTimeout(this.resizeTimeout) | ||
this._clearPendingResizeTimeouts(); | ||
window.removeEventListener('resize', this._handleResize); | ||
@@ -279,3 +282,6 @@ }, | ||
// setTimeout of 0 gives element enough time to have assumed its new size if it is being resized | ||
this.resizeTimeout = window.setTimeout(function() { | ||
var resizeTimeout = window.setTimeout(function() { | ||
// drop this timeout from pendingResizeTimeouts to reduce memory usage | ||
this.pendingResizeTimeouts.shift(); | ||
var slider = this.refs.slider; | ||
@@ -297,4 +303,15 @@ var handle = this.refs.handle0; | ||
}.bind(this), 0); | ||
this.pendingResizeTimeouts.push(resizeTimeout); | ||
}, | ||
// clear all pending timeouts to avoid error messages after unmounting | ||
_clearPendingResizeTimeouts: function() { | ||
do { | ||
var nextTimeout = this.pendingResizeTimeouts.shift(); | ||
clearTimeout(nextTimeout); | ||
} while (this.pendingResizeTimeouts.length); | ||
}, | ||
// calculates the offset of a handle in pixels based on its value. | ||
@@ -301,0 +318,0 @@ _calcOffset: function (value) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34526
687