fix: ended page scopes start no timers; SSH transfers keep their connection from the idle sweep; linked files download whole; only the sent item unpacks on an SSH host, replace and skip as on a machine
This commit is contained in:
1 parent
e05ff05015
commit
64ce8f2b72
7 files changed
+175
-52
No files matched your search
@@ -15,24 +15,7 @@
|
||||
|
||||
function register(name, mod) { modules[name] = mod; }
|
||||
|
||||
// scope gives a module timers, requests and listeners that end with it.
|
||||
function scope() {
|
||||
const timers = new Set(), offs = [], ac = new AbortController();
|
||||
return {
|
||||
timeout(fn, ms) { const id = setTimeout(() => { timers.delete(id); fn(); }, ms); timers.add(id); return id; },
|
||||
interval(fn, ms) { const id = setInterval(fn, ms); timers.add(id); return id; },
|
||||
clear(id) { clearTimeout(id); clearInterval(id); timers.delete(id); },
|
||||
fetch(url, opt) {
|
||||
const o = Object.assign({credentials: 'same-origin'}, opt || {});
|
||||
// A request with its own signal ends on either.
|
||||
o.signal = o.signal && AbortSignal.any ? AbortSignal.any([o.signal, ac.signal]) : (o.signal || ac.signal);
|
||||
return fetch(url, o);
|
||||
},
|
||||
on(target, ev, fn, opt) { target.addEventListener(ev, fn, opt); offs.push(() => target.removeEventListener(ev, fn, opt)); },
|
||||
signal: ac.signal,
|
||||
end() { timers.forEach(id => { clearTimeout(id); clearInterval(id); }); timers.clear(); offs.forEach(f => f()); ac.abort(); }
|
||||
};
|
||||
}
|
||||
const scope = WSUtil.scope;
|
||||
|
||||
function unmount(area) {
|
||||
const m = mounted.get(area);
|
||||
|
||||
Reference in new issue
Block a user