diff --git a/src/hoverClass.ts b/src/hoverClass.ts index 8dc45bcd..eda707a0 100644 --- a/src/hoverClass.ts +++ b/src/hoverClass.ts @@ -2,7 +2,7 @@ import store from './store' import filter from './filter' import throttle from './throttle' -import { addEventListener as on, removeEventListener as off } from './eventListener' +import { addEventListener, removeEventListener } from './eventListener' /** * enable or disable hoverClass on mouseenter/leave if container Items * @param {sortable} sortableContainer a valid sortableContainer @@ -14,7 +14,7 @@ export default (sortableContainer: sortable, enable: boolean) => { const hoverClasses = store(sortableContainer).getConfig('hoverClass').split(' ') // add class on hover if (enable === true) { - on(sortableContainer, 'mousemove', throttle((event) => { + addEventListener(sortableContainer, 'mousemove', throttle((event) => { // check of no mouse button was pressed when mousemove started == no drag if (event.buttons === 0) { filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(item => { @@ -27,15 +27,15 @@ export default (sortableContainer: sortable, enable: boolean) => { } }, store(sortableContainer).getConfig('throttleTime'))) // remove class on leave - on(sortableContainer, 'mouseleave', () => { + addEventListener(sortableContainer, 'mouseleave', () => { filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(item => { item.classList.remove(...hoverClasses) }) }) // remove events } else { - off(sortableContainer, 'mousemove') - off(sortableContainer, 'mouseleave') + removeEventListener(sortableContainer, 'mousemove') + removeEventListener(sortableContainer, 'mouseleave') } } } diff --git a/src/serialize.ts b/src/serialize.ts index a98885ff..b1c0af92 100644 --- a/src/serialize.ts +++ b/src/serialize.ts @@ -1,5 +1,5 @@ /* eslint-env browser */ -import { addData as data } from './data' // yuk, data really needs to be refactored +import { addData } from './data' // yuk, data really needs to be refactored import filter from './filter' import getIndex from './getIndex' /** @@ -18,7 +18,7 @@ export default (sortableContainer: HTMLElement, customItemSerializer: Function = throw new Error('You need to provide a valid serializer for items and the container.') } // get options - const options = data(sortableContainer, 'opts') + const options = addData(sortableContainer, 'opts') const item: string|undefined = options.items