mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-18 20:05:16 +00:00
Add call counter
This commit is contained in:
@ -66,6 +66,14 @@ class CallWindow extends CustomEvents {
|
||||
" <span class='pull-right'></span>"
|
||||
})
|
||||
|
||||
// Add counter
|
||||
this.timeEl = createElem2({
|
||||
insertBefore: this.windowHead.querySelector(".pull-right"),
|
||||
type: "span",
|
||||
class: "time",
|
||||
innerHTML: "00:00:00"
|
||||
})
|
||||
|
||||
// Close button
|
||||
this.closeButton = createElem2({
|
||||
appendTo: this.windowHead.querySelector(".pull-right"),
|
||||
@ -74,6 +82,20 @@ class CallWindow extends CustomEvents {
|
||||
onclick: () => this.Close()
|
||||
})
|
||||
|
||||
// Make counter lives
|
||||
this.callDuration = 0;
|
||||
const interval = setInterval(() => {
|
||||
|
||||
if(!this.timeEl.isConnected)
|
||||
clearInterval(interval)
|
||||
|
||||
this.callDuration++;
|
||||
this.timeEl.innerHTML = rpad(Math.floor(this.callDuration/3600), 2, 0) + ":"
|
||||
+ rpad(Math.floor((this.callDuration/60)%60), 2, 0) + ":"
|
||||
+ rpad(this.callDuration%60, 2, 0)
|
||||
}, 1000);
|
||||
|
||||
|
||||
this.makeWindowDraggable();
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user