Skip to content

Commit af32c9b

Browse files
Christian Meixnerarschmitz
Christian Meixner
authored andcommitted
Recognizer: Fix leaking options between recognizer instances
We need to copy the options object into a new object upon instantiation Fixes #813 Closes #816
1 parent 5fc4e8d commit af32c9b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/recognizer.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ var STATE_FAILED = 32;
4040
* @param {Object} options
4141
*/
4242
function Recognizer(options) {
43+
// make sure, options are copied over to a new object to prevent leaking it outside
44+
options = extend({}, options || {});
45+
4346
this.id = uniqueId();
4447

4548
this.manager = null;
46-
this.options = merge(options || {}, this.defaults);
49+
this.options = merge(options, this.defaults);
4750

4851
// default is enable true
4952
this.options.enable = ifUndefined(this.options.enable, true);

0 commit comments

Comments
 (0)