✏️ Code cleanup and adding jsDoc
This commit is contained in:
@@ -21,11 +21,17 @@ import { isEmpty, isUndefined } from "lodash";
|
|||||||
import { AIRDCPP_DOWNLOAD_PROGRESS_TICK } from "../constants/action-types";
|
import { AIRDCPP_DOWNLOAD_PROGRESS_TICK } from "../constants/action-types";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that initializes an AirDC++ socket connection
|
||||||
|
* 1. Initializes event listeners for download init, tick and complete events
|
||||||
|
* 2. Handles errors in case the connection to AirDC++ is not established or terminated
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
const AirDCPPSocketComponent = (): ReactElement => {
|
const AirDCPPSocketComponent = (): ReactElement => {
|
||||||
const airDCPPConfiguration = useContext(AirDCPPSocketContext);
|
const airDCPPConfiguration = useContext(AirDCPPSocketContext);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const foo = async () => {
|
const initializeAirDCPPEventListeners = async () => {
|
||||||
if (
|
if (
|
||||||
!isUndefined(airDCPPConfiguration.airDCPPState) &&
|
!isUndefined(airDCPPConfiguration.airDCPPState) &&
|
||||||
!isEmpty(airDCPPConfiguration.airDCPPState.settings) &&
|
!isEmpty(airDCPPConfiguration.airDCPPState.settings) &&
|
||||||
@@ -73,7 +79,7 @@ const AirDCPPSocketComponent = (): ReactElement => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
foo();
|
initializeAirDCPPEventListeners();
|
||||||
}, [airDCPPConfiguration]);
|
}, [airDCPPConfiguration]);
|
||||||
return <></>;
|
return <></>;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { Form, Field } from "react-final-form";
|
|||||||
import Collapsible from "react-collapsible";
|
import Collapsible from "react-collapsible";
|
||||||
import { fetchComicVineMatches } from "../actions/fileops.actions";
|
import { fetchComicVineMatches } from "../actions/fileops.actions";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { refineQuery } from "filename-parser";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for performing search against ComicVine
|
* Component for performing search against ComicVine
|
||||||
|
|||||||
Reference in New Issue
Block a user