Skip to content

Commit 13aa8e4

Browse files
committed
feat($plugin-active-header-links): replace throttle by debounce
1 parent e0ef407 commit 13aa8e4

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

Diff for: packages/@vuepress/plugin-active-header-links/clientRootMixin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* global AHL_SIDEBAR_LINK_SELECTOR, AHL_HEADER_ANCHOR_SELECTOR */
22

3-
import throttle from 'lodash.throttle'
3+
import debounce from 'lodash.debounce'
44

55
export default {
66
mounted () {
77
window.addEventListener('scroll', this.onScroll)
88
},
99

1010
methods: {
11-
onScroll: throttle(function () {
11+
onScroll: debounce(function () {
1212
this.setActiveHash()
1313
}, 300),
1414

Diff for: packages/@vuepress/plugin-active-header-links/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"generator"
1919
],
2020
"dependencies": {
21-
"lodash.throttle": "^4.1.1"
21+
"lodash.debounce": "^4.0.8"
2222
},
2323
"author": "ULIVZ <[email protected]>",
2424
"license": "MIT",

Diff for: yarn.lock

-4
Original file line numberDiff line numberDiff line change
@@ -7304,10 +7304,6 @@ lodash.templatesettings@^4.0.0:
73047304
dependencies:
73057305
lodash._reinterpolate "~3.0.0"
73067306

7307-
lodash.throttle@^4.1.1:
7308-
version "4.1.1"
7309-
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
7310-
73117307
73127308
version "4.0.1"
73137309
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"

0 commit comments

Comments
 (0)