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


   All of the tests in the [merged 
branch](https://github.com/apache/incubator-flagon-useralejs/tree/UncleGedd-sendOnClose)
 are passing on my end, using Node version v14.8.0 and I don't have any global 
packages.
   
   When I was testing the viability of web workers I was swapping between tabs 
and closing the tab that the example page was open in. Both of those actions 
resulted in a seeing a custom web worker log in the terminal where the example 
server was running. I'm confident that the log was coming from the web worker 
itself, not `sendOnRefresh `.  I was doing something like this in 
[worker.js](https://github.com/apache/incubator-flagon-useralejs/blob/UncleGedd-sendOnClose/src/worker.js):
   ```js
   export function workerSendLog(e) {
       const {url, logs} = e.data
       fetch(url, {
           method: 'POST',
           headers: {
               'Content-Type': 'application/json'
           },
           body: JSON.stringify([{webworker: 'from web worker'}]) // custom web 
worker log
       })
   }
   ```
   
   One thing to make sure of is to set the `data-interval` to some value >1 in 
`example/index.html` and ensure that there are logs in the queue before closing 
the page (ie. click a couple of times and then close the tab to ensure there 
are logs to be flushed by the web worker).
   
   I saw when running the example app that `index.js` was not being loaded, 
looks like this was due to Express not using the base directory to serve files 
from? I pushed a small change to the example app in that [merged 
branch](https://github.com/apache/incubator-flagon-useralejs/tree/UncleGedd-sendOnClose).
   
   Check out this video I made showing the behavior I'm seeing: 
https://youtu.be/ri0AHBMai20


-- 
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