mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-25 21:39:21 +00:00
Notify server when joining call
This commit is contained in:
parent
51dcef4565
commit
f3466a98e0
@ -14,10 +14,13 @@ class CallWindow extends CustomEvents {
|
||||
*/
|
||||
constructor(conv) {
|
||||
super()
|
||||
this.conv = conv;
|
||||
this.construct(conv);
|
||||
}
|
||||
|
||||
async construct(conv) {
|
||||
|
||||
try {
|
||||
// Check if calls target exists or not
|
||||
if(!byId("callsTarget"))
|
||||
createElem2({
|
||||
@ -53,7 +56,17 @@ class CallWindow extends CustomEvents {
|
||||
onclick: () => this.Close()
|
||||
})
|
||||
|
||||
this.makeWindowDraggable()
|
||||
this.makeWindowDraggable();
|
||||
|
||||
// Join the call
|
||||
await ws("calls/join", {
|
||||
convID: this.conv.ID
|
||||
})
|
||||
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
notify("Could not initialize call!", "danger");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,9 +144,14 @@ class CallWindow extends CustomEvents {
|
||||
* @param {boolean} propagate Set to true to propagate
|
||||
* the event
|
||||
*/
|
||||
Close(propagate = true) {
|
||||
async Close(propagate = true) {
|
||||
this.rootEl.remove();
|
||||
|
||||
// Leave the call
|
||||
await ws("calls/leave", {
|
||||
convID: this.conv.ID
|
||||
})
|
||||
|
||||
if(propagate)
|
||||
this.emitEvent("close");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user