Skip to content

Commit

Permalink
add: throttleWait option
Browse files Browse the repository at this point in the history
  • Loading branch information
hilongjw committed Aug 31, 2017
1 parent 6fdf7c0 commit 01505fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DEFAULT_OBSERVER_OPTIONS = {

export default function (Vue) {
return class Lazy {
constructor ({ preLoad, error, preLoadTop, dispatchEvent, loading, attempt, silent, scale, listenEvents, hasbind, filter, adapter, observer, observerOptions }) {
constructor ({ preLoad, error, throttleWait, preLoadTop, dispatchEvent, loading, attempt, silent, scale, listenEvents, hasbind, filter, adapter, observer, observerOptions }) {
this.version = '__VUE_LAZYLOAD_VERSION__'
this.mode = 'event'
this.ListenerQueue = []
Expand All @@ -33,6 +33,7 @@ export default function (Vue) {
this.options = {
silent: silent || true,
dispatchEvent: !!dispatchEvent,
throttleWait: throttleWait || 200,
preLoad: preLoad || 1.3,
preLoadTop: preLoadTop || 0,
error: error || DEFAULT_URL,
Expand All @@ -48,7 +49,6 @@ export default function (Vue) {
observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
}
this._initEvent()

this.setMode(this.options.observer ? 'observer' : 'event')
}

Expand Down Expand Up @@ -207,7 +207,7 @@ export default function (Vue) {
catIn = listener.checkInView()
catIn && listener.load()
})
}, 200)
}, this.options.throttleWait)
} else {
this._initIntersectionObserver()
this.lazyLoadHandler = () => {}
Expand Down

0 comments on commit 01505fe

Please sign in to comment.