npm.io
1.1.1 • Published 7 years ago

is-natively-supported

Licence
MIT
Version
1.1.1
Deps
0
Size
2 kB
Vulns
0
Weekly
0

is-natively-supported

A micro library for building extensions or fallbacks for modern, not fully supported browser APIs such as Speech Recognition API

import IsNativelySupported from 'is-natively-supported'

class SpeechToText extends IsNativelySupported {

   constructor() {
      super('SpeechRecognition', 'webkitSpeechRecognition') // pass all known names to parent constructor

      if(SpeechToText.isNativelySupported()) {
         // register Speech Recognition API
      } else {
         // register fall back (Google, Watson, ...)
      }
   }

}