Skip to content

Commit

Permalink
Bump to 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinyChang committed May 19, 2017
1 parent 3bc5bf0 commit 5983492
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var TextTruncate = require('react-text-truncate'); // CommonJS or UMD


## Changelog
* 0.9.1 Fix async this.forceUpdate() issue
* 0.9.0 Fix infinity loop bug, upgrade react to 15.5.4 and support yarn
* 0.8.3 IE 11 compatibility
* 0.8.2 Fix wrong truncating when a container has long words without spaces
Expand Down
11 changes: 10 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}

var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;

var TextTruncate = function (_Component) {
_inherits(TextTruncate, _Component);

Expand All @@ -102,7 +105,10 @@
}

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TextTruncate.__proto__ || Object.getPrototypeOf(TextTruncate)).call.apply(_ref, [this].concat(args))), _this), _this.onResize = function () {
window.requestAnimationFrame(_this.update.bind(_this));
if (_this.rafId) {
cancelAnimationFrame(_this.rafId);
}
_this.rafId = requestAnimationFrame(_this.update.bind(_this));
}, _this.update = function () {
_this.forceUpdate();
}, _temp), _possibleConstructorReturn(_this, _ret);
Expand All @@ -126,6 +132,9 @@
key: 'componentWillUnmount',
value: function componentWillUnmount() {
window.removeEventListener('resize', this.onResize);
if (this.rafId) {
cancelAnimationFrame(this.rafId);
}
}
}, {
key: 'measureWidth',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-text-truncate",
"version": "0.9.0",
"version": "0.9.1",
"description": "Truncate text for React.js",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 5983492

Please sign in to comment.