Skip to content

Instantly share code, notes, and snippets.

@easrng
Created April 17, 2021 16:58
Show Gist options
  • Save easrng/75c6150073eedb3e963eaff2961b0a9b to your computer and use it in GitHub Desktop.
Save easrng/75c6150073eedb3e963eaff2961b0a9b to your computer and use it in GitHub Desktop.
async function chromiumVendor(){
let chromium=navigator.userAgent.includes("Chrom")
if(!chromium) return null
if(navigator.userAgent.includes("Edg")) return "microsoft"
if(navigator.brave) return "brave"
let google=await new Promise(cb=>{
let ae=false;
function ov(){
cb(speechSynthesis.getVoices().filter(e=>e.name.includes("Google")).length!=0)
if(ae) speechSynthesis.removeEventListener("voiceschanged", ov)
}
if(speechSynthesis.getVoices().length==0) {
ae=true
speechSynthesis.addEventListener("voiceschanged", ov)
} else ov()
})
if(google) return "google"
return "other"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment