make TintableSvgs responsible for updating their own tints, and stop storing SVG DOM fragments in Tinter to avoid leaking them
This commit is contained in:
parent
8c1bb90347
commit
0f52c0a514
2 changed files with 19 additions and 20 deletions
|
@ -31,6 +31,10 @@ module.exports = React.createClass({
|
|||
className: React.PropTypes.string,
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
this.dispatcherRef = dis.register(this.onAction);
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
// we can't use onLoad on object due to https://github.com/facebook/react/pull/5781
|
||||
// so handle it with pure DOM instead
|
||||
|
@ -39,6 +43,12 @@ module.exports = React.createClass({
|
|||
|
||||
componentWillUnmount: function() {
|
||||
ReactDOM.findDOMNode(this).removeEventListener('load', this.onLoad);
|
||||
dis.unregister(this.dispatcherRef);
|
||||
},
|
||||
|
||||
onAction: function(payload) {
|
||||
if (payload.action !== 'tint_update') return;
|
||||
Tinter.tintSvg(ReactDOM.findDOMNode(this));
|
||||
},
|
||||
|
||||
onLoad: function(event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue