Add custom events to window or DOM element
yarn add @lucasvallenet/js-custom-events
npm i @lucasvallenet/js-custom-events
// Import event
import { scrollstart } from '@lucasvallenet/js-custom-events'
// Execute function
scrollstart()
// Add callback (window by default)
window.addEventListener('scrollstart', () => console.log('scrollstart'))
// Import event
import { movestart } from '@lucasvallenet/js-custom-events'
// Get DOM element
const myDiv = document.getElementById('my-div')
// Execute function with the DOM element as parameter
movestart(myDiv)
// Add callback
myDiv.addEventListener('movestart', () => console.log('movestart'))
scrollstart
| scrollend
scrollup
| scrolldown
movestart
| moveend