move setInitialState to events.js

This commit is contained in:
Leon Bubova committed 2021-12-18 01:28:43 +01:00
1 parent ed9a950d12
commit 4342f7e36f
2 files changed
+11 -8

No files matched your search

+2 -8
View File
@@ -10,6 +10,7 @@ import {
isVideoLiked,
getState,
setState,
setInitialState,
setLikes,
setDislikes,
getLikeCountFromButton,
@@ -27,13 +28,6 @@ let storedData = {
previousState: NEUTRAL_STATE,
};
function setInitialState() {
setState(storedData);
setTimeout(() => {
sendVideoIds();
}, 1500);
}
let jsInitChecktimer = null;
function setEventListeners(evt) {
@@ -47,7 +41,7 @@ function setEventListeners(evt) {
buttons.children[1].addEventListener("click", () => dislikeClicked(storedData));
window.returnDislikeButtonlistenersSet = true;
}
setInitialState();
setInitialState(storedData);
}
}
+9
View File
@@ -1,6 +1,7 @@
import { getLikeButton, getDislikeButton, getButtons } from "./buttons";
import { createRateBar } from "./bar";
import { getBrowser, getVideoId, cLog, numberFormat } from "./utils";
import { sendVideoIds } from "./events";
const LIKED_STATE = "LIKED_STATE";
const DISLIKED_STATE = "DISLIKED_STATE";
@@ -96,12 +97,20 @@ function setState(storedData) {
);
}
function setInitialState(storedData) {
setState(storedData);
setTimeout(() => {
sendVideoIds();
}, 1500);
}
export {
isMobile,
isVideoDisliked,
isVideoLiked,
getState,
setState,
setInitialState,
setLikes,
setDislikes,
getLikeCountFromButton,