a demonstration replicated social networking web app built with anproto wiredove.net/
social ed25519 protocols
at main 33 lines 822 B view raw
1import { render } from './render.js' 2import { apds } from 'apds' 3 4const addPosts = async (posts, div) => { 5 for (const post of posts) { 6 div.appendChild(await render.hash(post.hash)) 7 setTimeout(async () => { 8 const sig = await apds.get(post.hash) 9 await render.blob(sig) 10 }, 1) 11 } 12} 13 14export const adder = (log, src, div) => { 15 if (log && log[0]) { 16 let index = 0 17 18 const reverse = log.slice().reverse() 19 let posts = reverse.slice(index, index + 25) 20 21 addPosts(posts, div) 22 index = index + 25 23 24 window.onscroll = () => { 25 if (((window.innerHeight + window.scrollY) >= document.body.scrollHeight - 1000) && window.location.hash.substring(1) === src) { 26 posts = reverse.slice(index, index + 25) 27 index = index + 25 28 addPosts(posts, div) 29 } 30 } 31 } 32} 33