Skip to content

Commit

Permalink
[#3] use debounce to replace throttle
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbing committed Oct 27, 2016
1 parent 7117187 commit d5427fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-scroll-behavior",
"version": "0.1.4",
"version": "0.1.5",
"description": "Scroll behaviors for use with history, inspired by scroll-behavior",
"main": "lib/index.js",
"files": [
Expand Down Expand Up @@ -58,7 +58,7 @@
"dependencies": {
"dom-helpers": "^2.4.0",
"exenv": "^1.2.0",
"lodash.isarray": "^4.0.0",
"lodash.throttle": "^4.0.1"
"lodash.debounce": "^4.0.8",
"lodash.isarray": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import scrollTop from 'dom-helpers/query/scrollTop'
import on from 'dom-helpers/events/on'
import throttle from 'lodash.throttle'
import debounce from 'lodash.debounce'
import { canUseDOM } from 'exenv'
import {
createKey,
Expand Down Expand Up @@ -36,6 +36,6 @@ export default function (history, config={}) {
}
}

on(window, 'scroll', throttle(onScroll, scrollThreshold))
on(window, 'scroll', debounce(onScroll, scrollThreshold))
return history
}

0 comments on commit d5427fd

Please sign in to comment.