Buckets:
silverwolf-x/project / packages /next /src /next-devtools /dev-overlay /components /overlay /body-locker.ts
| let previousBodyPaddingRight: string | undefined | |
| let previousBodyOverflowSetting: string | undefined | |
| let activeLocks = 0 | |
| export function lock() { | |
| setTimeout(() => { | |
| if (activeLocks++ > 0) { | |
| return | |
| } | |
| const scrollBarGap = | |
| window.innerWidth - document.documentElement.clientWidth | |
| if (scrollBarGap > 0) { | |
| previousBodyPaddingRight = document.body.style.paddingRight | |
| document.body.style.paddingRight = `${scrollBarGap}px` | |
| } | |
| previousBodyOverflowSetting = document.body.style.overflow | |
| document.body.style.overflow = 'hidden' | |
| }) | |
| } | |
| export function unlock() { | |
| setTimeout(() => { | |
| if (activeLocks === 0 || --activeLocks !== 0) { | |
| return | |
| } | |
| if (previousBodyPaddingRight !== undefined) { | |
| document.body.style.paddingRight = previousBodyPaddingRight | |
| previousBodyPaddingRight = undefined | |
| } | |
| if (previousBodyOverflowSetting !== undefined) { | |
| document.body.style.overflow = previousBodyOverflowSetting | |
| previousBodyOverflowSetting = undefined | |
| } | |
| }) | |
| } | |
Xet Storage Details
- Size:
- 1.05 kB
- Xet hash:
- 90937682d18e921f1f6f13bbd8f3982ad7aa9a32a65fbcdc3b87ed17215e2fd9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.