Skip to content

Latest commit

 

History

History
executable file
·
79 lines (58 loc) · 1.96 KB

README.md

File metadata and controls

executable file
·
79 lines (58 loc) · 1.96 KB

AnyControl

AnyControl is a small JavaScript SpeechRecognition library that lets your users control your site with voice commands. It is build on top of Webkit Speech API.

AnyControl has no dependencies, just 3 KB small, and is free to use and modify under the MIT license.

NPM

Issues Forks Stars License Package CodeOfConduct

Browser support

Google Chrome 31+

Getting started

<script src="https://unpkg.com/anycontrol/dist/index.umd.min.js"></script>
<script>
  var ctrl = new anycontrol()

  ctrl.addCommand("previous page", function() {
    console.log('Go to previous page')
  });

  ctrl.addCommand("next page", function () {
    console.log('Go to next page')
  });

  ctrl.start();
</script>

API

Add command

ctrl.addCommand("home", function() {
  // Navigate to home
});

ctrl.addCommand("search", function(param) {
  console.log("Search for:", param);
});

Remove command

ctrl.removeCommand("search");

Start listening (continuously)

ctrl.start();

Stop listening

ctrl.stop();

Get single command

ctrl.getCommand();

Turn debug mode on/off

ctrl.debug(true|false);

LICENSE

MIT