fix scripts init

This commit is contained in:
igoradamenko
2018-04-28 22:46:03 +03:00
parent db581ee23d
commit 6829029227
4 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import { COUNTER_NODE_CLASSNAME } from './common/constants'
import api from 'common/api';
if (document.readyState !== 'interactive') {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
+1 -1
View File
@@ -1,6 +1,6 @@
import { BASE_URL, NODE_ID } from 'common/constants';
if (document.readyState !== 'interactive') {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
+1 -1
View File
@@ -6,7 +6,7 @@ import api from 'common/api';
import ListComments from 'components/list-comments';
if (document.readyState !== 'interactive') {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
+5 -1
View File
@@ -9,7 +9,11 @@ import { NODE_ID } from './common/constants';
require('./components/document');
init();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
function init() {
const node = document.getElementById(NODE_ID);