mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 09:58:39 +00:00
implement voice navigation
This commit is contained in:
parent
6691f99f40
commit
1174a90dfe
|
|
@ -59,12 +59,18 @@ export class VoiceManager
|
|||
}
|
||||
|
||||
this.recognition.onstart = function() {};
|
||||
this.recognition.addEventListener('end', this.recognition.start);
|
||||
|
||||
this.recognition.onresult = function(event)
|
||||
{
|
||||
let result = jsOMS.trim(event.results[event.resultIndex][0].transcript);
|
||||
|
||||
if (self.commands.hasOwnProperty(result)) {
|
||||
self.commands[result]();
|
||||
const commands = Object.keys(self.commands);
|
||||
|
||||
for (let command of commands) {
|
||||
if (result.startsWith(command)) {
|
||||
self.commands[command](result.substr(command.length).trim());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user