Last active
August 9, 2021 05:57
-
-
Save rayriffy/8bdb79461e3d33b42029632fca45c4c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let getAllNameInMeeting = () => Array.from(document.querySelector('calling-roster-section[data-tid=participantsInCall]').querySelectorAll('div.name > span')).map(o => o.textContent.toLowerCase()) | |
let leaveIfSomeoneLeave = (name) => { | |
try { | |
const lowerCaseNames = getAllNameInMeeting() | |
// if not found, then leave | |
if (!lowerCaseNames.includes(name)) { | |
console.log(`[leaveIfSomeoneLeave] "${name}" is leaving! stopping the call`) | |
document.querySelector('#hangup-button').click() | |
} else { | |
console.log(`[leaveIfSomeoneLeave] ${lowerCaseNames.length} people in metting right now, found "${name}" in the list`) | |
} | |
} catch (e) { | |
// noop | |
} | |
} | |
let execute = (name, intervalTime = 1000) => { | |
const intervalId = setInterval(() => leaveIfSomeoneLeave(name), intervalTime) | |
const stop = () => clearInterval(intervalId) | |
return { | |
intervalId, | |
stop, | |
} | |
} | |
// let studentWorker = execute('someone', 10 * 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment