{"id":29027282,"url":"https://github.com/rameel/pagelock","last_synced_at":"2026-01-12T10:01:43.883Z","repository":{"id":219823459,"uuid":"750002977","full_name":"rameel/pagelock","owner":"rameel","description":"A simple utility for managing page scroll locking. No external dependencies.","archived":false,"fork":false,"pushed_at":"2025-03-09T15:30:28.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T23:17:14.495Z","etag":null,"topics":["page-locking","pagelock","scroll-lock","scroll-locking"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rameel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-29T20:01:03.000Z","updated_at":"2025-03-09T15:30:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"b14311e5-6045-46a7-bd18-f8100a4ebfd5","html_url":"https://github.com/rameel/pagelock","commit_stats":null,"previous_names":["rameel/pagelock"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rameel/pagelock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameel%2Fpagelock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameel%2Fpagelock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameel%2Fpagelock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameel%2Fpagelock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rameel","download_url":"https://codeload.github.com/rameel/pagelock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameel%2Fpagelock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["page-locking","pagelock","scroll-lock","scroll-locking"],"created_at":"2025-06-26T06:05:20.660Z","updated_at":"2026-01-12T10:01:43.869Z","avatar_url":"https://github.com/rameel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @ramstack/pagelock\n[![NPM](https://img.shields.io/npm/v/@ramstack/pagelock)](https://www.npmjs.com/package/@ramstack/pagelock)\n[![MIT](https://img.shields.io/github/license/rameel/pagelock)](https://github.com/rameel/pagelock/blob/main/LICENSE)\n\n`@ramstack/pagelock` is a simple utility for managing page scroll locking.\nThe library is around 750 bytes in size and has no external dependencies.\n\n## Installation\n\n### Using NPM\n```sh\nnpm install --save @ramstack/pagelock\n```\n\n### Using CDN\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@ramstack/pagelock@1/dist/pagelock.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage examples\n\n#### Vanilla JS\n\n```vue\n\u003cbutton onclick=\"show()\"\u003eShow Modal\u003c/button\u003e\n\n\u003cscript\u003e\n    let release;\n\n    async function show() {\n        // Lock the page scroll before showing the modal dialog\n        release = pagelock();\n\n        await showModal();\n\n        // Unlock the page scroll\n        release();\n    }\n\u003c/script\u003e\n```\n\n#### Vue\n\n```vue\n\u003cscript setup\u003e\n\nimport { ref, watch } from \"vue\";\nimport { pagelock } from \"@ramstack/pagelock\";\n\nlet show = ref(false);\nlet release;\n\nwatch(show, value =\u003e {\n  if (value) {\n    // Lock page scroll\n    release = pagelock();\n  }\n  else {\n    // Unlock page scroll\n    release?.();\n  }\n});\n\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003clabel\u003e\n    \u003cinput v-model=\"show\" type=\"checkbox\" /\u003e\n    Lock page\n  \u003c/label\u003e\n  \u003cdiv style=\"height: 1000px; width: 100%\"\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n```\n\n## Functions\n\n```js\n/**\n * Locks the page scroll. Subsequent calls to the function add to the queue of lock holders.\n * The page scroll remains locked until the queue is empty. To forcibly release the page scroll,\n * bypassing the queue, call the {@link pageunlock} function with `force = true`.\n *\n * @returns {() =\u003e void} - A function to unlock the page scroll.\n * Subsequent calls to this release function are safe: it only releases its own lock\n * without affecting the others in the queue.\n */\nfunction pagelock(): () =\u003e void;\n```\n\n```js\n/**\n * Unlocks the page scroll. Unlike the release function returned by {@link pagelock},\n * this function removes locks from the end of the queue (one by one).\n *\n * @param {boolean} [force] - If `true`, forcibly unlocks the page scroll, clearing the entire queue.\n * Otherwise, only the most recent lock is released. Defaults to `false`.\n */\nfunction pageunlock(force?: boolean): void;\n```\n\n## License\nThis package is released under the **MIT License**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frameel%2Fpagelock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frameel%2Fpagelock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frameel%2Fpagelock/lists"}