File tree Expand file tree Collapse file tree 2 files changed +2
-36
lines changed Expand file tree Collapse file tree 2 files changed +2
-36
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ class ChatBoxState extends State<ChatBox> {
138138 // messageFilter and highlightedWords are set as options for the chatbox
139139 _createConversation ();
140140
141- execute ('chatBox.mount(document.getElementById("talkjs-container"));' );
141+ execute ('chatBox.mount(document.getElementById("talkjs-container")).then(() => JSCLoadingState.postMessage("loaded")) ;' );
142142 } else {
143143 // If it's not the first time that the widget is built,
144144 // then check what needs to be rebuilt
@@ -191,23 +191,6 @@ class ChatBoxState extends State<ChatBox> {
191191 execute ('options["me"] = $variableName ;' );
192192
193193 execute ('const session = new Talk.Session(options);' );
194-
195- execute ('''
196- const observer = new MutationObserver((mutations) => {
197- for (let mutation of mutations) {
198- for (let node of mutation.addedNodes) {
199- if (node.nodeName.toLowerCase().indexOf('iframe') >= 0) {
200- observer.disconnect();
201- node.addEventListener('load', () => {
202- JSCLoadingState.postMessage('loaded');
203- });
204- }
205- }
206- }
207- });
208-
209- observer.observe(document.getElementById('talkjs-container'), {childList: true});
210- ''' );
211194 }
212195
213196 void _createChatBox () {
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ class ConversationListState extends State<ConversationList> {
133133 _createConversationList ();
134134 // feedFilter is set as an option for the inbox
135135
136- execute ('conversationList.mount(document.getElementById("talkjs-container"));' );
136+ execute ('conversationList.mount(document.getElementById("talkjs-container")).then(() => JSCLoadingState.postMessage("loaded")) ;' );
137137 } else {
138138 // If it's not the first time that the widget is built,
139139 // then check what needs to be rebuilt
@@ -170,23 +170,6 @@ class ConversationListState extends State<ConversationList> {
170170 execute ('options["me"] = $variableName ;' );
171171
172172 execute ('const session = new Talk.Session(options);' );
173-
174- execute ('''
175- const observer = new MutationObserver((mutations) => {
176- for (let mutation of mutations) {
177- for (let node of mutation.addedNodes) {
178- if (node.nodeName.toLowerCase().indexOf('iframe') >= 0) {
179- observer.disconnect();
180- node.addEventListener('load', () => {
181- JSCLoadingState.postMessage('loaded');
182- });
183- }
184- }
185- }
186- });
187-
188- observer.observe(document.getElementById('talkjs-container'), {childList: true});
189- ''' );
190173 }
191174
192175 void _createConversationList () {
You can’t perform that action at this time.
0 commit comments