in src/components/Widget/index.js [63:91]
componentDidMount() {
const { connectOn, autoClearCache, storage, dispatch, defaultHighlightAnimation } = this.props;
// add the default highlight css to the document
const styleNode = document.createElement('style');
styleNode.innerHTML = defaultHighlightAnimation;
document.body.appendChild(styleNode);
dispatch(evalUrl(window.location.href));
if (connectOn === 'mount') {
this.initializeWidget();
return;
}
const localSession = getLocalSession(storage, SESSION_NAME);
const lastUpdate = localSession ? localSession.lastUpdate : 0;
if (autoClearCache) {
if (Date.now() - lastUpdate < 30 * 60 * 1000) {
this.initializeWidget();
} else {
localStorage.removeItem(SESSION_NAME);
}
} else {
this.checkVersionBeforePull();
dispatch(pullSession());
if (lastUpdate) this.initializeWidget();
}
}