Skip to content

Commit 518c68c

Browse files
committed
v0.3.8
1 parent da7f2d1 commit 518c68c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

dist/react-simple-chatbot.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ChatBot.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class ChatBot extends Component {
127127
componentDidMount() {
128128
const { recognitionEnable } = this.state;
129129
const { recognitionLang } = this.props;
130+
130131
if (recognitionEnable) {
131132
this.recognition = new Recognition(
132133
this.onRecognitionChange,
@@ -135,8 +136,11 @@ class ChatBot extends Component {
135136
recognitionLang,
136137
);
137138
}
138-
this.content.addEventListener('DOMNodeInserted', this.onNodeInserted);
139-
window.addEventListener('resize', this.onResize);
139+
140+
if (this.content) {
141+
this.content.addEventListener('DOMNodeInserted', this.onNodeInserted);
142+
window.addEventListener('resize', this.onResize);
143+
}
140144
}
141145

142146
componentWillUpdate(nextProps, nextState) {
@@ -148,8 +152,10 @@ class ChatBot extends Component {
148152
}
149153

150154
componentWillUnmount() {
151-
this.content.removeEventListener('DOMNodeInserted', this.onNodeInserted);
152-
window.removeEventListener('resize', this.onResize);
155+
if (this.content) {
156+
this.content.removeEventListener('DOMNodeInserted', this.onNodeInserted);
157+
window.removeEventListener('resize', this.onResize);
158+
}
153159
}
154160

155161
onNodeInserted(event) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-simple-chatbot",
3-
"version": "0.3.7",
3+
"version": "0.3.8",
44
"description": "React Simple Chatbot",
55
"main": "dist/react-simple-chatbot.js",
66
"scripts": {

0 commit comments

Comments
 (0)