fix scripts init
This commit is contained in:
+1
-1
@@ -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
@@ -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();
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user