nsfwalex commited on
Commit
8b6e01d
1 Parent(s): 95df1f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -158,7 +158,11 @@ window.postMessageToParent = function(prompt, event, source, value) {
158
  // Post the message to the parent window
159
  window.parent.postMessage(message, '*');
160
  }else if(isValidEnv()){
161
- sendCustomEventToDataLayer({},event,source,value)
 
 
 
 
162
  }else{
163
  console.log("Not in an iframe, can't post to parent");
164
  }
@@ -184,7 +188,11 @@ function uploadImage(prompt, images, event, source, value) {
184
  };
185
  window.parent.postMessage(JSON.stringify(data), '*');
186
  } else if (isValidEnv()){
187
- sendCustomEventToDataLayer({},event,source,{"prompt": prompt, "image":imageUrl})
 
 
 
 
188
  }else{
189
  console.log("Not in an iframe, can't post to parent");
190
  }
 
158
  // Post the message to the parent window
159
  window.parent.postMessage(message, '*');
160
  }else if(isValidEnv()){
161
+ try{
162
+ sendCustomEventToDataLayer({},event,source,value)
163
+ } catch (error) {
164
+ console.error("Error in sendCustomEventToDataLayer:", error);
165
+ }
166
  }else{
167
  console.log("Not in an iframe, can't post to parent");
168
  }
 
188
  };
189
  window.parent.postMessage(JSON.stringify(data), '*');
190
  } else if (isValidEnv()){
191
+ try{
192
+ sendCustomEventToDataLayer({},event,source,{"prompt": prompt, "image":imageUrl})
193
+ } catch (error) {
194
+ console.error("Error in sendCustomEventToDataLayer:", error);
195
+ }
196
  }else{
197
  console.log("Not in an iframe, can't post to parent");
198
  }