Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.mockImplementation((wrapper, bscrollOptions) => {
return {
wrapper,
options: bscrollOptions,
initiated: 1,
pointX: 0,
pointY: 0,
startClickRegister: new EventRegister(wrapper, []),
moveEndRegister: new EventRegister(wrapper, []),
hooks: new EventEmitter(['beforeStart', 'start', 'move', 'end', 'click']),
destroy: jest.fn()
}
})
constructor(
public indicator: Indicator,
public options: EventHandlerOptions
) {
this.bscroll = indicator.bscroll
this.startEventRegister = new EventRegister(this.indicator.el, [
{
name: options.disableMouse ? 'touchstart' : 'mousedown',
handler: this._start.bind(this)
}
])
this.endEventRegister = new EventRegister(window, [
{
name: options.disableMouse ? 'touchend' : 'mouseup',
handler: this._end.bind(this)
}
])
this.hooks = new EventEmitter(['touchStart', 'touchMove', 'touchEnd'])
}
.mockImplementation((wrapper, bscrollOptions) => {
return {
wrapper,
options: bscrollOptions,
initiated: 1,
pointX: 0,
pointY: 0,
startClickRegister: new EventRegister(wrapper, []),
moveEndRegister: new EventRegister(wrapper, []),
hooks: new EventEmitter(['beforeStart', 'start', 'move', 'end', 'click']),
destroy: jest.fn()
}
})
'refresh',
'touchEnd',
'end',
'flick',
'scrollCancel',
'momentum',
'scrollTo',
'scrollToElement',
'transitionEnd',
'checkClick',
'ignoreDisMoveForSamePos'
]),
scrollBehaviorX,
scrollBehaviorY,
resizeRegister: new EventRegister(wrapper, []),
transitionEndRegister: new EventRegister(wrapper, [])
}
})
constructor(
public indicator: Indicator,
public options: EventHandlerOptions
) {
this.bscroll = indicator.bscroll
this.startEventRegister = new EventRegister(this.indicator.el, [
{
name: options.disableMouse ? 'touchstart' : 'mousedown',
handler: this._start.bind(this)
}
])
this.endEventRegister = new EventRegister(window, [
{
name: options.disableMouse ? 'touchend' : 'mouseup',
handler: this._end.bind(this)
}
])
this.hooks = new EventEmitter(['touchStart', 'touchMove', 'touchEnd'])
}
'scrollEnd',
'refresh',
'touchEnd',
'end',
'flick',
'scrollCancel',
'momentum',
'scrollTo',
'scrollToElement',
'transitionEnd',
'checkClick',
'ignoreDisMoveForSamePos'
]),
scrollBehaviorX,
scrollBehaviorY,
resizeRegister: new EventRegister(wrapper, []),
transitionEndRegister: new EventRegister(wrapper, [])
}
})
private _start(e: TouchEvent) {
let point = (e.touches ? e.touches[0] : e) as Touch
e.preventDefault()
e.stopPropagation()
this.initiated = true
this.moved = false
this.lastPoint = point[this.indicator.keysMap.pointPos]
const { disableMouse } = this.bscroll.options
this.moveEventRegister = new EventRegister(window, [
{
name: disableMouse ? 'touchmove' : 'mousemove',
handler: this._move.bind(this)
}
])
this.hooks.trigger('touchStart')
}