Procházet zdrojové kódy

Notify join leave others

master
Roderic Day před 5 roky
rodič
revize
a25209dbf1
1 změnil soubory, kde provedl 3 přidání a 3 odebrání
  1. +3
    -3
      pico.js

+ 3
- 3
pico.js Zobrazit soubor

@@ -29,7 +29,7 @@ listen('state', ({detail}) => {
delete detail.kind
Object.assign(State, detail)
})
const doNotLog = new Set(['login', 'state', 'post', 'peerInfo', 'join', 'leave'])
const doNotLog = new Set(['login', 'state', 'post', 'peerInfo'])
/*
*
* UTILS
@@ -58,12 +58,12 @@ const connect = (username) => {
if(message.online) {
const difference = (l1, l2) => l1.filter(u => !l2.includes(u))
difference(message.online, State.online).forEach(username => {
if(username === State.username) return
signal({kind: 'post', ts: message.ts, value: `${username} joined`})
signal({kind: 'join', username: username})
})
difference(State.online, message.online).forEach(username => {
if(username === State.username) return
signal({kind: 'post', ts: message.ts, value: `${username} left`})
signal({kind: 'leave', username: username})
})
}


Načítá se…
Zrušit
Uložit