From e301161b2386caebb18c5899dd9094045f9f3929 Mon Sep 17 00:00:00 2001 From: Daniel Kurowski <daniel.kurowski@grifart.cz> Date: Mon, 14 Sep 2020 09:39:58 +0200 Subject: [PATCH] Got rid of handleGlobalScrollingBehavior() --- README.md | 6 +++--- dist/index.d.ts | 3 +-- dist/index.esm.js | 6 +----- dist/index.js | 5 ----- src/esImportTest.ts | 1 - src/index.ts | 7 ------- src/integrationTest.html | 3 ++- 7 files changed, 7 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3ba5408..f22c531 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ is importable through standard ES `import` directive. |---|---| | **`handleOnLoadScroll()`** | Attaches scrolling to anchored element when the page is loaded.\* | | **`handleOnLinkClickScroll()`** | Attaches scrolling to given element when user clicks on an `a` tag having `href` starting with `#` character. | -| **`handleGlobalScrollingBehavior()`** | Calls all functions above. | Use these functions **in top-level code**: ```javascript -import {handleGlobalScrollingBehavior} from '@grifart/smoothscroll'; +import {handleOnLoadScroll, handleOnLinkClickScroll} from '@grifart/smoothscroll'; -handleGlobalScrollingBehavior(); +handleOnLoadScroll(); +handleOnLinkClickScroll(); ``` \*Note: when page load lasts more than 500 ms, load scroll effect diff --git a/dist/index.d.ts b/dist/index.d.ts index 37fb06b..f22f8f6 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -2,7 +2,6 @@ import { scrollToElement } from './scrollers/scrollToElement'; import { scrollToOffset } from './scrollers/scrollToOffset'; import { scrollToTarget } from './scrollers/scrollToTarget'; import { HashTarget } from './HashTarget'; -declare function handleGlobalScrollingBehavior(): void; declare function handleOnLoadScroll(): void; declare function handleOnLinkClickScroll(): void; -export { HashTarget, handleGlobalScrollingBehavior, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget, }; +export { HashTarget, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget, }; diff --git a/dist/index.esm.js b/dist/index.esm.js index 381d54b..0ec3668 100644 --- a/dist/index.esm.js +++ b/dist/index.esm.js @@ -219,10 +219,6 @@ function scrollToOffset(topOffset, onScrollFinishedCallback) { } bindEasingToVelocity(Velocity); -function handleGlobalScrollingBehavior() { - handleOnLoadScroll(); - handleOnLinkClickScroll(); -} function handleOnLoadScroll() { initializeOnLoadScroll(); } @@ -230,4 +226,4 @@ function handleOnLinkClickScroll() { initializeOnLinkClickScroll(); } -export { HashTarget, handleGlobalScrollingBehavior, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget }; +export { HashTarget, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, scrollToOffset, scrollToTarget }; diff --git a/dist/index.js b/dist/index.js index d3b9905..43bc650 100644 --- a/dist/index.js +++ b/dist/index.js @@ -222,10 +222,6 @@ } bindEasingToVelocity(Velocity); - function handleGlobalScrollingBehavior() { - handleOnLoadScroll(); - handleOnLinkClickScroll(); - } function handleOnLoadScroll() { initializeOnLoadScroll(); } @@ -234,7 +230,6 @@ } exports.HashTarget = HashTarget; - exports.handleGlobalScrollingBehavior = handleGlobalScrollingBehavior; exports.handleOnLoadScroll = handleOnLoadScroll; exports.handleOnLinkClickScroll = handleOnLinkClickScroll; exports.scrollToElement = scrollToElement; diff --git a/src/esImportTest.ts b/src/esImportTest.ts index 73ca019..672ba18 100644 --- a/src/esImportTest.ts +++ b/src/esImportTest.ts @@ -1,6 +1,5 @@ // dummy test // if import statements do not scream this test passes -import {handleGlobalScrollingBehavior} from './index'; import {handleOnLoadScroll} from './index'; import {handleOnLinkClickScroll} from './index'; import {scrollToElement} from './index'; diff --git a/src/index.ts b/src/index.ts index 3eb3715..2c03375 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,12 +12,6 @@ import {HashTarget} from './HashTarget'; bindEasingToVelocity(Velocity); -function handleGlobalScrollingBehavior(): void -{ - handleOnLoadScroll(); - handleOnLinkClickScroll(); -} - function handleOnLoadScroll(): void { initializeOnLoadScroll(); @@ -30,7 +24,6 @@ function handleOnLinkClickScroll(): void export { HashTarget, - handleGlobalScrollingBehavior, handleOnLoadScroll, handleOnLinkClickScroll, scrollToElement, diff --git a/src/integrationTest.html b/src/integrationTest.html index d74a879..9dbe038 100644 --- a/src/integrationTest.html +++ b/src/integrationTest.html @@ -7,7 +7,8 @@ <script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5/velocity.min.js"></script> <script src="../dist/index.js" type="text/javascript"></script> <script> - SmoothScroll.handleGlobalScrollingBehavior(); + SmoothScroll.handleOnLoadScroll(); + SmoothScroll.handleOnLinkClickScroll(); document.addEventListener('DOMContentLoaded', () => { document.getElementById('scrollToElement').addEventListener('click', (event) => { -- GitLab