Don't merge, it's prototypal

This commit is contained in:
Xamora
2023-11-30 16:36:21 +01:00
parent c2b6dbb989
commit af9595c447
5 changed files with 45 additions and 5 deletions

View File

@ -4,7 +4,7 @@ export default class extends AbstractAuthentifiedView {
constructor(params) {
super(params, "Chat");
let url = `wss://${window.location.host}/ws/socket-server/`
let url = `ws://${window.location.host}/ws/socket-server/`
this.chatSocket = new WebSocket(url)
this.chatSocket.onmessage = function(e){
@ -44,7 +44,7 @@ export default class extends AbstractAuthentifiedView {
<h1>Chat</h1>
<form id="form">
<input type="text" name="message" />
<input type="text" name="message" placeholder="message"/>
</form>
<div id="messages">

View File

@ -0,0 +1,38 @@
import AbstractAuthentifiedView from "./AbstractAuthentifiedView.js";
export default class extends AbstractAuthentifiedView {
constructor(params) {
super(params, "Search");
}
async postInit() {
let users = ["cramptéMan", "cacaMan", "chatteWomen"]
let list_users = document.getElementById('list_users');
for (const user of users) {
var new_user = document.createElement("li");
new_user.appendChild(document.createTextNode(user));
list_users.appendChild(new_user);
}
console.log(list_users);
}
async leavePage() {
}
async getHtml() {
return `
<h1>Search</h1>
<form id="form">
<input type="text" name="message" placeholder="user name to crampte"/>
</form>
<div id="users">
<ul id="list_users">
</ul>
</div>
`;
}
}

View File

@ -47,4 +47,4 @@ export default class extends AbstractAuthentifiedView {
</div>
`;
}
}
}