ソースを参照

Some decorative messaging

master
Roderic Day 5年前
コミット
be2e6ac30d
1個のファイルの変更8行の追加0行の削除
  1. +8
    -0
      pico.js

+ 8
- 0
pico.js ファイルの表示

@@ -262,6 +262,14 @@ const connect = (username) => {
State.websocket.onmessage = (e) => {
const message = JSON.parse(e.data)

if(message.online) {
const difference = (l1, l2) => l1.filter(u => !l2.includes(u))
difference(message.online, State.online).forEach(username =>
State.posts.push({ts: message.ts, value: `${username} joined`}))
difference(State.online, message.online).forEach(username =>
State.posts.push({ts: message.ts, value: `${username} left`}))
}

if(!doNotLog.has(message.kind)) {
console.log(message)
}

読み込み中…
キャンセル
保存