UNPKG

discussion

Version:

Basic implementating to help altering between ongoing SpeechRecognition and intermittant SpeechSynthesis

18 lines (17 loc) 597 B
/// <reference types="dom-speech-recognition" /> import { tryFindCommand, ResultType } from "./index"; var ongoingList = new SpeechRecognitionResultList(); ongoingList.item[0] = { isFinal: false }; const speechResultOngoing = { results: ongoingList, resultIndex: 0 }; const haystack = ["blue", "red", "GREEN", "pur ple"]; export function tests() { var result = tryFindCommand(speechResultOngoing, haystack); var expected = ResultType.RecognitionNotFinished; var assertion = result.resultType === expected; if (!assertion) { throw "FAILED"; } }