From e69dcf99fb2f7c8cf0aaeb226e8fe4cf0a2d4b14 Mon Sep 17 00:00:00 2001 From: NB <47492535+altmshfkgudtjr@users.noreply.github.com> Date: Sun, 18 Apr 2021 23:56:36 +0900 Subject: [PATCH] unnecessary package removed --- package.json | 7 ++----- src/components/sideMenu/Wrapper.tsx | 4 ++-- src/lib/utils/commonUtil.ts | 18 ++++++++++++++++++ src/modules/reactViewer/ReactViewer.tsx | 3 +-- yarn.lock | 10 ---------- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index cac66e9..7e85a51 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,7 @@ "postcompile": "cp -r ./src/types ./lib/types" }, "dependencies": { - "epubjs": "^0.3.88", - "throttle-debounce": "^3.0.1" + "epubjs": "^0.3.88" }, "devDependencies": { "@babel/cli": "^7.13.14", @@ -61,7 +60,6 @@ "@types/react-dom": "^17.0.0", "@types/react-redux": "^7.1.16", "@types/styled-components": "^5.1.7", - "@types/throttle-debounce": "^2.1.0", "babel-plugin-module-resolver": "4.0.0", "babel-plugin-styled-components": "^1.12.0", "gh-pages": "^3.1.0", @@ -73,8 +71,7 @@ "typescript": "^4.2.3" }, "peerDependencies": { - "react": ">=17.0.1", - "throttle-debounce": ">=3.0.1" + "react": ">=17.0.1" }, "eslintConfig": { "extends": [ diff --git a/src/components/sideMenu/Wrapper.tsx b/src/components/sideMenu/Wrapper.tsx index f230cee..9546660 100644 --- a/src/components/sideMenu/Wrapper.tsx +++ b/src/components/sideMenu/Wrapper.tsx @@ -38,12 +38,12 @@ const Container = styled.div` }; transition: .4s ${styles.transition}; overflow-y: auto; - ${styles.scrollbar()}; + ${styles.scrollbar(0)}; `; const Header = styled.div` width: 100%; - height: 64px; + min-height: 64px; display: flex; align-items: center; justify-content: space-between; diff --git a/src/lib/utils/commonUtil.ts b/src/lib/utils/commonUtil.ts index be8c1de..3f63200 100644 --- a/src/lib/utils/commonUtil.ts +++ b/src/lib/utils/commonUtil.ts @@ -198,4 +198,22 @@ export const getSelectionPosition = ( height: selectionHeight, width: selectionWidth }; +} + +/** + * Debounce + * @param func Target function + * @param timeout delay + */ + export function debounce( + timeout: number, + func: (...args: Params) => any, +): (...args: Params) => void { + let timer: NodeJS.Timeout + return (...args: Params) => { + clearTimeout(timer) + timer = setTimeout(() => { + func(...args) + }, timeout) + } } \ No newline at end of file diff --git a/src/modules/reactViewer/ReactViewer.tsx b/src/modules/reactViewer/ReactViewer.tsx index bd175c8..3daac52 100644 --- a/src/modules/reactViewer/ReactViewer.tsx +++ b/src/modules/reactViewer/ReactViewer.tsx @@ -1,12 +1,11 @@ import React, { useState, useEffect, useRef, useCallback, useMemo } from "react" import { Book, Rendition, Contents } from "epubjs" -import { debounce } from "throttle-debounce" // modules import EpubViewer from "modules/epubViewer/EpubViewer" // components import LoadingView from 'LoadingView' // utils -import { timeFormatter } from 'lib/utils/commonUtil' +import { debounce, timeFormatter } from 'lib/utils/commonUtil' // styles import viewerDefaultStyles from 'modules/reactViewer/viewerStyle' // types diff --git a/yarn.lock b/yarn.lock index a552c89..1fe252e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2128,11 +2128,6 @@ dependencies: "@types/jest" "*" -"@types/throttle-debounce@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz#1c3df624bfc4b62f992d3012b84c56d41eab3776" - integrity sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ== - "@types/uglify-js@*": version "3.13.0" resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.13.0.tgz#1cad8df1fb0b143c5aba08de5712ea9d1ff71124" @@ -11071,11 +11066,6 @@ throat@^5.0.0: resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== -throttle-debounce@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-3.0.1.tgz#32f94d84dfa894f786c9a1f290e7a645b6a19abb" - integrity sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg== - through2@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"