Extracting custom event creation into a util module

This commit is contained in:
Jeff Avallone
2014-12-19 10:24:45 -05:00
parent 0d6e272216
commit 78917d44e6
6 changed files with 37 additions and 21 deletions
+2 -5
View File
@@ -1,3 +1,4 @@
import { customEvent } from './util.js';
import Parser from './parser/javascript.js';
import Snap from 'snapsvg';
import Q from 'q';
@@ -20,17 +21,13 @@ export default class Regexper {
}
keypressListener(event) {
var evt;
if (event.shiftKey && event.keyCode === 13) {
event.returnValue = false;
if (event.preventDefault) {
event.preventDefault();
}
evt = document.createEvent('Event');
evt.initEvent('submit', true, true);
this.form.dispatchEvent(evt);
this.form.dispatchEvent(customEvent('submit'));
}
}