I am writing an event log using web workers to process it in a secondary process. An employee collects events locally and then sends them as a batch every few seconds.
I need a way to send any unsent batches if the browser or tab closes. Is there a way for a web artist to listen to something like an event onclose?
onclose
I understand that I can do this in the application itself, but the log is a node package that will be used in several places, and I would prefer not to make the front part responsible for cleaning the event log.
-, , " " " ", . , , , .
, self.onclose = function() { ... };, , . . , WorkerGlobalScope. WorkerGlobalScope.self , onclose().
self.onclose = function() { ... };
WorkerGlobalScope
WorkerGlobalScope.self
onclose()
, API . , , ( , Microsoft IE/Edge). - - , , , @T.J. , .