annyang_rails 0.2.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzE5NzFjZmY0ZTNhZThlOTA2NWExMDJjZGU5Y2VhYmRiYTY5NDY4OQ==
4
+ NGExMzcxZDZhYzJlNmYxZjM0YmVhNDRiYjIxNjY0NzkwNmEzZWE1MA==
5
5
  data.tar.gz: !binary |-
6
- OTM1Njc4ZTAxYTgzOTIyYzQxYmIwZWY2MmI2M2I3NjM4YjQwMTk3OQ==
6
+ MGRhN2Y5ZWNiMGExZmU1ZDk3MTQzODFhYjIzMzUyODlkNTI1MDMwNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDRhMjgwNGRmNjIyNjc3MjA5ZjhmN2E0YTE4MDc4ZWE3MzkzMzQ5Njk1MDkz
10
- MWI5YjQ0NTFjYzE2Y2I1YTQzZDU5MzE5YTQ5MzA3NzdkYTk3N2ExZWU5ZmE1
11
- MTNhOWY1NWM1NTJjY2IxM2E1N2VmNzRlNDAzODRjMmUzYWFmYWE=
9
+ NDZlZjIwMTkyNjI5NTMwODIxOWM5Y2IzMDE3Njk5ZTZjZWQ5Y2JmMGYxNWY4
10
+ MWViZWMxYjBmNmE1ZDdlNTc5ZGI4ODUyMDVjODE5NmM4OTdhNzYzZTNhNzVl
11
+ YjM2MjE5YWY3MGViZTY3Zjk2MjZkY2E0MmQxOTQ2OGUwNDFlMjg=
12
12
  data.tar.gz: !binary |-
13
- NGE5MTI5NzJkMjM4OThjMTU5OWE1ZTk3ZTdlMGIyOWE5ZWQzZTRjMmIzYjZi
14
- M2UxNDVmZWI1ZWNjNDM0MTk4YTlkMDhhN2Q1OWZlZjliMDc0ODg4NzlhODBm
15
- ZTk0Y2VhM2RlYTM0YTQ2N2Q1NGE5NDIwM2FhOTUwMGU4YjM4MDI=
13
+ ODBjOWYyMDhiYzVkNmI5N2E5NzAzMTYyNjc4OWYyMTg4ZDdlNzA1ODAyNDcz
14
+ ZmJjYTY3Zjg1MGIzNjBiMjA3ODc2YTM2MmQ0OGMyYjVlYzQwZWRiYWRmMjA5
15
+ MTcyOWM1NTYyNDdjZDg0NTMyOWM1MjQ3YmQ3Zjg4ZmQzN2FmNjU=
@@ -1,5 +1,5 @@
1
1
  //! annyang
2
- //! version : 0.2.0
2
+ //! version : 1.0.0
3
3
  //! author : Tal Ater @TalAter
4
4
  //! license : MIT
5
5
  //! https://www.TalAter.com/annyang/
@@ -10,15 +10,15 @@
10
10
  var root = this;
11
11
 
12
12
  // Get the SpeechRecognition object, while handling browser prefixes
13
- var SpeechRecognition = root.webkitSpeechRecognition ||
13
+ var SpeechRecognition = root.SpeechRecognition ||
14
+ root.webkitSpeechRecognition ||
14
15
  root.mozSpeechRecognition ||
15
16
  root.msSpeechRecognition ||
16
- root.oSpeechRecognition ||
17
- root.SpeechRecognition;
17
+ root.oSpeechRecognition;
18
18
 
19
19
  // Check browser support
20
20
  // This is done as early as possible, to make it as fast as possible for unsupported browsers
21
- if ( !SpeechRecognition ) {
21
+ if (!SpeechRecognition) {
22
22
  root.annyang = null;
23
23
  return null;
24
24
  }
@@ -51,9 +51,9 @@
51
51
 
52
52
  // This method receives an array of callbacks to iterate over, and invokes each of them
53
53
  var invokeCallbacks = function(callbacks) {
54
- for (var j = 0, l = callbacks.length; j < l; j++) {
55
- callbacks[j].callback.apply(callbacks[j].context);
56
- }
54
+ callbacks.forEach(function(callback) {
55
+ callback.callback.apply(callback.context);
56
+ });
57
57
  };
58
58
 
59
59
  root.annyang = {
@@ -211,6 +211,19 @@
211
211
  }
212
212
  },
213
213
 
214
+ // Remove existing commands. Called with a single phrase or an array of phrases
215
+ removeCommands: function(commandsToRemove) {
216
+ commandsToRemove = Array.isArray(commandsToRemove) ? commandsToRemove : [commandsToRemove];
217
+ commandsList = commandsList.filter(function(command) {
218
+ for (var i = 0; i<commandsToRemove.length; i++) {
219
+ if (commandsToRemove[i] === command.originalPhrase) {
220
+ return false;
221
+ }
222
+ }
223
+ return true;
224
+ });
225
+ },
226
+
214
227
  // Lets the user add a callback of one of 9 types:
215
228
  // start, error, end, result, resultMatch, resultNoMatch, errorNetwork, errorPermissionBlocked, errorPermissionDenied
216
229
  // Can also optionally receive a context for the callback function as the third argument
@@ -1,3 +1,3 @@
1
1
  module AnnyangRails
2
- VERSION = "0.2.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annyang_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Israeli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2014-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler