react-offcharts-core
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -38,3 +38,3 @@ import React from 'react'; | ||
Chart.prototype.onResize.restore(); | ||
expect(spyOne.callCount).toBe(3); | ||
expect(spyOne.callCount).toBe(2); | ||
Component2.unmount(); | ||
@@ -41,0 +41,0 @@ }); |
@@ -18,2 +18,6 @@ 'use strict'; | ||
var _resizeObserverPolyfill = require('resize-observer-polyfill'); | ||
var _resizeObserverPolyfill2 = _interopRequireDefault(_resizeObserverPolyfill); | ||
var _ReactIf = require('./ReactIf'); | ||
@@ -63,3 +67,3 @@ | ||
if (_this.props.responsive === true) { | ||
_this.resize = (0, _lodash2.default)(_this.onResize.bind(_this), 150); | ||
_this.onResize = _this.onResize.bind(_this); | ||
} | ||
@@ -76,4 +80,9 @@ return _this; | ||
value: function componentDidMount() { | ||
var _this2 = this; | ||
if (this.props.responsive === true) { | ||
window.addEventListener('resize', this.resize); | ||
this.ro = new _resizeObserverPolyfill2.default(function (ent, obs) { | ||
(0, _lodash2.default)(_this2.onResize(), 250); | ||
}); | ||
this.ro.observe(this.chart); | ||
} | ||
@@ -89,4 +98,4 @@ this.onResize(); | ||
value: function componentWillUnmount() { | ||
if (this.props.responsive === true) { | ||
window.removeEventListener('resize', this.resize); | ||
if (this.ro) { | ||
this.ro.disconnect(); | ||
} | ||
@@ -113,3 +122,3 @@ } | ||
value: function render() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
@@ -140,3 +149,3 @@ // Copy the state to pass down to the children | ||
ref: function ref(c) { | ||
_this2.chart = c; | ||
_this3.chart = c; | ||
}, | ||
@@ -143,0 +152,0 @@ id: this.props.id, |
{ | ||
"name": "react-offcharts-core", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A Core Library for React Offcharts", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
38889
1082