Page type-check: noImplicitAny, every parameter and variable typed (#235)
290 places the type-check could not see into, mostly parameters, now typed with web/src/types.ts (feeds, items, files, accounts, log lines, the directory's rows and items). Two changes run differently in form only: the seek and volume inputs divide Number(value) where they divided the string, and esc's table has a name. Null checks are #236. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/* ---------------- live events ---------------- */
|
||||
let sse;
|
||||
let sse: EventSource;
|
||||
/// The feed list and the open list, taken again from the server. The events keep both current,
|
||||
/// and one missed is a count wrong until a reload: reading an item sends none to your other
|
||||
/// pages, so one read on another device stayed unread here, and an iPhone stops the stream while
|
||||
/// the app is in the background, when everything is missed (#168).
|
||||
const catchUp=(()=>{ let t; return ()=>{ clearTimeout(t); t=setTimeout(()=>{
|
||||
const catchUp=(()=>{ let t: number; return ()=>{ clearTimeout(t); t=setTimeout(()=>{
|
||||
loadFeeds(true).catch(()=>{});
|
||||
if(S.feed) loadEntries().catch(()=>{});
|
||||
},300); }; })();
|
||||
@@ -14,11 +14,11 @@ function connect(){
|
||||
sse=new EventSource('/api/events');
|
||||
// Back after a drop: whatever was sent meanwhile went to nobody.
|
||||
sse.onopen=()=>{ if(dropped){ dropped=false; catchUp(); } };
|
||||
const soon=(fn,ms=500)=>{ let t; return ()=>{ clearTimeout(t); t=setTimeout(fn,ms); }; };
|
||||
const soon=(fn: ()=>void,ms=500)=>{ let t: number; return ()=>{ clearTimeout(t); t=setTimeout(fn,ms); }; };
|
||||
// Caught: a network gone when one fires (a laptop asleep) was an unhandled rejection (#219).
|
||||
const refreshEntries=soon(()=>{ if(S.feed) loadEntries().catch(()=>{}); });
|
||||
// Every scan's events reach everyone; only this person's feeds are theirs to show or refresh.
|
||||
const mine=id=>S.feeds.some(f=>f.id===id);
|
||||
const mine=(id: string)=>S.feeds.some(f=>f.id===id);
|
||||
sse.onmessage=m=>{
|
||||
let ev; try{ ev=JSON.parse(m.data) }catch{ return }
|
||||
if(ev.ev==='progress'){
|
||||
|
||||
Reference in New Issue
Block a user