react-twitter-widgets
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -35,2 +35,7 @@ 'use strict'; | ||
_createClass(AbstractWidget, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.willUnmount = false; | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
@@ -46,2 +51,7 @@ value: function componentDidMount() { | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.willUnmount = true; | ||
} | ||
}, { | ||
key: 'loadWidget', | ||
@@ -65,3 +75,5 @@ value: function loadWidget() { | ||
value: function done() { | ||
this.removeChildrenExceptLast(this.refs.widgetWrapper); | ||
if (this.willUnmount) { | ||
this.removeChildrenExceptLast(this.refs.widgetWrapper); | ||
} | ||
} | ||
@@ -71,4 +83,6 @@ }, { | ||
value: function removeChildren(node) { | ||
while (node.firstChild) { | ||
node.removeChild(node.firstChild); | ||
if (node) { | ||
while (node.firstChild) { | ||
node.removeChild(node.firstChild); | ||
} | ||
} | ||
@@ -79,4 +93,6 @@ } | ||
value: function removeChildrenExceptLast(node) { | ||
while (node.childNodes.length > 1) { | ||
node.removeChild(node.firstChild); | ||
if (node) { | ||
while (node.childNodes.length > 1) { | ||
node.removeChild(node.firstChild); | ||
} | ||
} | ||
@@ -83,0 +99,0 @@ } |
{ | ||
"name": "react-twitter-widgets", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Twitter widgets as React components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,2 +9,6 @@ import React from 'react' | ||
componentWillMount() { | ||
this.willUnmount = false | ||
} | ||
componentDidMount() { | ||
@@ -18,2 +22,6 @@ this.loadWidget() | ||
componentWillUnmount() { | ||
this.willUnmount = true | ||
} | ||
loadWidget() { | ||
@@ -32,8 +40,12 @@ const { widgetWrapper } = this.refs | ||
done() { | ||
this.removeChildrenExceptLast(this.refs.widgetWrapper) | ||
if (this.willUnmount) { | ||
this.removeChildrenExceptLast(this.refs.widgetWrapper) | ||
} | ||
} | ||
removeChildren(node) { | ||
while (node.firstChild) { | ||
node.removeChild(node.firstChild) | ||
if (node) { | ||
while (node.firstChild) { | ||
node.removeChild(node.firstChild) | ||
} | ||
} | ||
@@ -43,4 +55,6 @@ } | ||
removeChildrenExceptLast(node) { | ||
while (node.childNodes.length > 1) { | ||
node.removeChild(node.firstChild) | ||
if (node) { | ||
while (node.childNodes.length > 1) { | ||
node.removeChild(node.firstChild) | ||
} | ||
} | ||
@@ -47,0 +61,0 @@ } |
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
37829
755