landvex: Fixar och tester klara för alla komponenter
- Datafabrik: Dockerfile fix, agentorkestrering fungerar - Vision: Identify-modell, FAISS, OCR alla testade - API: Alla 7 integrationstester passerade - Upplösare: Entitetsupplösning verifierad
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
/* global WorkerGlobalScope */
|
||||
|
||||
function add(fn) {
|
||||
if (typeof WorkerGlobalScope === 'function' && self instanceof WorkerGlobalScope) {
|
||||
// this is run inside of a webworker
|
||||
} else {
|
||||
|
||||
/**
|
||||
* if we are on react-native, there is no window.addEventListener
|
||||
* @link https://github.com/pubkey/unload/issues/6
|
||||
*/
|
||||
if (typeof window.addEventListener !== 'function') return;
|
||||
|
||||
/**
|
||||
* for normal browser-windows, we use the beforeunload-event
|
||||
*/
|
||||
window.addEventListener('beforeunload', () => {
|
||||
fn();
|
||||
}, true);
|
||||
|
||||
/**
|
||||
* for iframes, we have to use the unload-event
|
||||
* @link https://stackoverflow.com/q/47533670/3443137
|
||||
*/
|
||||
window.addEventListener('unload', () => {
|
||||
fn();
|
||||
}, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO add fallback for safari-mobile
|
||||
* @link https://stackoverflow.com/a/26193516/3443137
|
||||
*/
|
||||
}
|
||||
|
||||
export default {
|
||||
add
|
||||
};
|
||||
Reference in New Issue
Block a user