quasar
Version:
Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
18 lines (15 loc) • 358 B
JavaScript
import preventScroll from '../../utils/scroll/prevent-scroll.js'
export default function usePreventScroll() {
let currentState
return {
preventBodyScroll(state) {
if (
state !== currentState &&
(currentState !== void 0 || state === true)
) {
currentState = state
preventScroll(state)
}
}
}
}