18 lines
276 B
JavaScript
18 lines
276 B
JavaScript
|
/* global ws, $ */ "use strict";
|
||
|
|
||
|
|
||
|
|
||
|
ws.onmessage = socket => {
|
||
|
const data = JSON.parse(socket.data);
|
||
|
|
||
|
switch (true) {
|
||
|
case data.message === "updated html":
|
||
|
$(data.selector).html(data.html);
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
console.log(data);
|
||
|
break;
|
||
|
}
|
||
|
};
|