poorejc commented on issue #50:
URL: 
https://github.com/apache/incubator-flagon-useralejs/issues/50#issuecomment-801268658


   Some forensics: sendOnClose was not functioning, at all.
   
   It appears there were two failures:
   
   1. sendOnClose doesn't execute because it is conditional on !config.on which 
is equivalent to not-started (as in UserALE.js) is not started. This is 
short-hand for state == interactive (see ./src/main.js). I don't know why this 
doesn't work, but for page lifecycle events as fast as navigations, it could be 
that the function breaks as userale.js is infact unloaded and the config object 
doesn't exist anymore.
   
   2. sendOnClose uses 2 methods to try to send logs:
   --  if (navigator.sendBeacon) {
       window.addEventListener('unload', function() {
         navigator.sendBeacon(config.url, JSON.stringify(logs));
       });
     } else {
   --  window.addEventListener('beforeunload', function() {
         if (logs.length > 0) {
           sendLogs(logs, config, 1);
   Neither of these appear working using the /example page: first the /example 
page doesn't init a navigator.sendbeacon on the page. second, 'beforeunload' is 
unreliable. Though I didn't run all permutations of removing notstarted logic 
and using each of these options indepenedently. 
   
   I can't get it to work.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to