| @@ -22,9 +22,10 @@ const signal = (message) => dispatchEvent(new CustomEvent(message.kind, {detail: | |||
| const signalPeerStop = (username) => signal({kind: 'peerInfo', value: {type: 'stop'}, source: username}) | |||
| const listen = (kind, handler) => addEventListener(kind, handler) | |||
| listen('login', ({detail}) => State.username = detail.value) | |||
| listen('state', ({detail}) => Object.assign(State, detail)) | |||
| listen('post', ({detail}) => State.posts.push(detail)) | |||
| listen('peerInfo', (e) => onPeerInfo(e)) | |||
| const doNotLog = new Set(['login', 'post', 'peerInfo']) | |||
| const doNotLog = new Set(['login', 'state', 'post', 'peerInfo']) | |||
| /* | |||
| * | |||
| @@ -261,10 +262,6 @@ const connect = (username) => { | |||
| State.websocket.onmessage = (e) => { | |||
| const message = JSON.parse(e.data) | |||
| if(message.online) { | |||
| State.online = message.online | |||
| } | |||
| if(!doNotLog.has(message.kind)) { | |||
| console.log(message) | |||
| } | |||