diff --git a/bower.json b/bower.json index c9d4415..bb56f0e 100755 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "voice-elements", - "version": "0.2.0", + "version": "1.0.0", "description": "Web Speech API wrapper that allows you to do voice recognition (speech to text) and speech synthesis (text to speech) using Polymer.", "authors": [ "Zeno Rocha " @@ -23,6 +23,6 @@ "bower_components" ], "dependencies": { - "polymer": "Polymer/polymer#^0.9.0" + "polymer": "Polymer/polymer#^1.0.0" } } diff --git a/dist/voice-player.html b/dist/voice-player.html index cb5eec6..eee5985 100644 --- a/dist/voice-player.html +++ b/dist/voice-player.html @@ -1,14 +1,28 @@ - - - - - diff --git a/dist/voice-recognition.html b/dist/voice-recognition.html index 3cd9b4f..4896c2e 100644 --- a/dist/voice-recognition.html +++ b/dist/voice-recognition.html @@ -1,13 +1,20 @@ - - - - - diff --git a/index.html b/index.html index cc8e498..1d9239e 100755 --- a/index.html +++ b/index.html @@ -94,7 +94,7 @@

<voice-player>

diff --git a/src/voice-recognition.html b/src/voice-recognition.html index a912e4c..b37fb4a 100644 --- a/src/voice-recognition.html +++ b/src/voice-recognition.html @@ -36,30 +36,21 @@ this.recognition.interimResults = false; // Initialize event listeners - [ - 'start', - 'error', - 'end' - ].forEach(this.propagateEvent.bind(this)); - this.bindResult(); - }, + var events = ['start', 'end', 'error']; + events.forEach(this._propagateEvent.bind(this)); - /* -- Methods --------------------------------------------------- */ - start: function() { - this.recognition.start(); - }, - stop: function() { - this.recognition.stop(); - }, - abort: function() { - this.recognition.abort(); + this._bindResult(); }, - /* -- Events ---------------------------------------------------- */ - propagateEvent: function (eventName) { - this.recognition.addEventListener(eventName, this.fire.bind(this, eventName)); + /* -- Private Methods ------------------------------------------- */ + _propagateEvent: function (eventName) { + var that = this; + + this.recognition.addEventListener(eventName, function(e) { + that.fire(eventName, e); + }); }, - bindResult: function() { + _bindResult: function() { var that = this; this.recognition.addEventListener('result', function(e) { @@ -70,6 +61,17 @@ that.fire('result', e); }); + }, + + /* -- Public Methods -------------------------------------------- */ + start: function() { + this.recognition.start(); + }, + stop: function() { + this.recognition.stop(); + }, + abort: function() { + this.recognition.abort(); } });