浏览代码

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)
}

正在加载...
取消
保存