Updating main JS to not run if not on the index page

This is to get the karma tests in a position where they can be written
This commit is contained in:
Jeff Avallone 2014-12-16 13:33:20 -05:00
parent 8651fd0d9b
commit dbae70ce52
1 changed files with 9 additions and 6 deletions

View File

@ -2,12 +2,15 @@ import Regexper from './regexper.js';
(function() {
var regexper = new Regexper(document.body);
regexper.bindListeners();
setTimeout(() => {
var evt = document.createEvent('Event');
if (document.body.querySelector('#content')) {
regexper.bindListeners();
evt.initEvent('hashchange', true, true);
window.dispatchEvent(evt);
});
setTimeout(() => {
var evt = document.createEvent('Event');
evt.initEvent('hashchange', true, true);
window.dispatchEvent(evt);
});
}
}());