Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private getEaseTime() {
const DEFAULT_EASETIME = 300
const SAFE_EASETIME = 100
const easeTime = this.mouseWheelOpt.easeTime || DEFAULT_EASETIME
// scrollEnd event will be triggered in every calling of scrollTo when easeTime is too small
// easeTime needs to be greater than 100
if (easeTime < SAFE_EASETIME) {
warn(`easeTime should be greater than 100.
If mouseWheel easeTime is too small, scrollEnd will be triggered many times.`)
}
return easeTime
}
}
'scrollEnd',
'scrollCancel',
'touchEnd',
'flick',
'destroy'
])
const wrapper = getElement(el)
if (!wrapper) {
warn('Can not resolve the wrapper DOM.')
return
}
const content = wrapper.children[0]
if (!content) {
warn('The wrapper need at least one child element to be scroller.')
return
}
this.plugins = {}
this.options = new Options().merge(options).process()
this.hooks = new EventEmitter([
'init',
'refresh',
'enable',
'disable',
'destroy'
])
this.init(wrapper)
}
'enable',
'disable',
'beforeScrollStart',
'scrollStart',
'scroll',
'scrollEnd',
'scrollCancel',
'touchEnd',
'flick',
'destroy'
])
const wrapper = getElement(el)
if (!wrapper) {
warn('Can not resolve the wrapper DOM.')
return
}
const content = wrapper.children[0]
if (!content) {
warn('The wrapper need at least one child element to be scroller.')
return
}
this.plugins = {}
this.options = new Options().merge(options).process()
this.hooks = new EventEmitter([
'init',
'refresh',
'enable',
'disable',
'destroy'
])
static use(ctor: PluginCtor) {
const name = ctor.pluginName
const installed = this.plugins.some(plugin => ctor === plugin.ctor)
if (installed) return this
if (isUndef(name)) {
warn(
`Plugin Class must specify plugin's name in static property by 'pluginName' field.`
)
return this
}
if (this.pluginsMap[name]) {
warn(
`This plugin has been registered, maybe you need change plugin's name`
)
return this
}
this.pluginsMap[name] = true
this.plugins.push({
name,
enforce: ctor.enforce,
ctor
})
return this
}
private checkSlideLoop() {
this.needLoop = this.slideOpt.loop!
if (this.pagesPos.xLen > 1) {
this.slideX = true
}
if (this.pagesPos.pages[0] && this.pagesPos.yLen > 1) {
this.slideY = true
}
this.loopX = this.needLoop && this.slideX
this.loopY = this.needLoop && this.slideY
if (this.slideX && this.slideY) {
warn('slide does not support two direction at the same time.')
}
}
}