Show HN: All visitors pointers on a webpage (How-to)
hexagon.56k.guru
Show HN: All visitors pointers on a webpage (How-to)
1–10 of 10 posts
Re: Show HN: All visitors pointers on a webpage (How-to)
#2Re: Show HN: All visitors pointers on a webpage (How-to)
#3I'm curious how well will it work with 5 thousand pointers...
Re: Show HN: All visitors pointers on a webpage (How-to)
#4I'm curious how well will it work with 5 thousand pointers...
Would work quite well i think, at last if deployed to deno deploy
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?Re: Show HN: All visitors pointers on a webpage (How-to)
#5Earlier quoted context omitted.
Would work quite well i think, at last if deployed to deno deploy
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?
Re: Show HN: All visitors pointers on a webpage (How-to)
#6Earlier quoted context omitted.
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?
It was just a quickie for fun, but maybe I should look into that
ws.onmessage = function(event) {
const positionIds = new Set(positions.map(pos => pos.id));
Object.keys(cursors).forEach((id) => {
if (!positionIds.has(id)) {
document.body.removeChild(cursors[id]);
delete cursors[id];
}
});
};
Untested but that’s probably pretty close for phone typingRe: Show HN: All visitors pointers on a webpage (How-to)
#7Earlier quoted context omitted.
It was just a quickie for fun, but maybe I should look into that
Yeah, I’d maybe make a set of just the position IDs, and do a negated .has() of that set to check if the cursor was removed. ws.onmessage = function(event) { const positionIds = new Set(positions.map(pos => pos.id)); Object.keys(cursors).forEach((id) => { if (!positionIds.has(id)) { document.body.removeChild(cursors[id]); delete cursors[id]; } }); }; Untested but that’s probably pretty close for phone typing
Re: Show HN: All visitors pointers on a webpage (How-to)
#8Earlier quoted context omitted.
It was just a quickie for fun, but maybe I should look into that
Yeah, I’d maybe make a set of just the position IDs, and do a negated .has() of that set to check if the cursor was removed. ws.onmessage = function(event) { const positionIds = new Set(positions.map(pos => pos.id)); Object.keys(cursors).forEach((id) => { if (!positionIds.has(id)) { document.body.removeChild(cursors[id]); delete cursors[id]; } }); }; Untested but that’s probably pretty close for phone typing
Re: Show HN: All visitors pointers on a webpage (How-to)
#9Dimden shows all mouse pointers on the web page, the page in general is absolute mint.
Re: Show HN: All visitors pointers on a webpage (How-to)
#10https://dimden.dev/ Dimden shows all mouse pointers on the web page, the page in general is absolute mint.