Skip to content

Commit

Permalink
Recognizer: Fix leaking options between recognizer instances
Browse files Browse the repository at this point in the history
We need to copy the options object into a new object upon instantiation

Fixes #813
Closes #816
  • Loading branch information
Christian Meixner authored and arschmitz committed Aug 7, 2015
1 parent 5fc4e8d commit af32c9b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ var STATE_FAILED = 32;
* @param {Object} options
*/
function Recognizer(options) {
// make sure, options are copied over to a new object to prevent leaking it outside
options = extend({}, options || {});

this.id = uniqueId();

this.manager = null;
this.options = merge(options || {}, this.defaults);
this.options = merge(options, this.defaults);

// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
Expand Down

0 comments on commit af32c9b

Please sign in to comment.