top | item 37417518 (no title) Hexagon56k | 2 years ago Would work quite well i think, at last if deployed to deno deploy discuss order hn newest yetihehe|2 years ago And kill browsers... ws.onmessage = function(event) { Object.keys(cursors).forEach((id) => { if (!positions.find((pos) => pos.id === id)) { document.body.removeChild(cursors[id]); delete cursors[id]; } }); If I'm not mistaken, this has O(n^2) complexity and is executed on EACH position update. Unless it's autooptimized to not be a linear search on positions? Hexagon56k|2 years ago It was just a quickie for fun, but maybe I should look into that load replies (1)
yetihehe|2 years ago And kill browsers... ws.onmessage = function(event) { Object.keys(cursors).forEach((id) => { if (!positions.find((pos) => pos.id === id)) { document.body.removeChild(cursors[id]); delete cursors[id]; } }); If I'm not mistaken, this has O(n^2) complexity and is executed on EACH position update. Unless it's autooptimized to not be a linear search on positions? Hexagon56k|2 years ago It was just a quickie for fun, but maybe I should look into that load replies (1)
Hexagon56k|2 years ago It was just a quickie for fun, but maybe I should look into that load replies (1)
yetihehe|2 years ago
Hexagon56k|2 years ago