{"id":19325255,"url":"https://github.com/preco21/prevent-unload","last_synced_at":"2025-02-24T06:16:40.119Z","repository":{"id":57330230,"uuid":"49398711","full_name":"preco21/prevent-unload","owner":"preco21","description":"Prevent page unloading from the user's action","archived":false,"fork":false,"pushed_at":"2020-05-08T12:21:20.000Z","size":3932,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T11:17:06.876Z","etag":null,"topics":["beforeunload","browser","page","prevent","unload"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/preco21.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}},"created_at":"2016-01-11T03:05:59.000Z","updated_at":"2023-03-04T06:21:46.000Z","dependencies_parsed_at":"2022-09-21T02:20:44.285Z","dependency_job_id":null,"html_url":"https://github.com/preco21/prevent-unload","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fprevent-unload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fprevent-unload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fprevent-unload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preco21%2Fprevent-unload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/preco21","download_url":"https://codeload.github.com/preco21/prevent-unload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240427326,"owners_count":19799471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["beforeunload","browser","page","prevent","unload"],"created_at":"2024-11-10T02:09:22.743Z","updated_at":"2025-02-24T06:16:39.601Z","avatar_url":"https://github.com/preco21.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prevent-unload\n\n[![Code Style Prev](https://img.shields.io/badge/code%20style-prev-32c8fc.svg)](https://github.com/preco21/eslint-config-prev)\n[![NPM Version](https://img.shields.io/npm/v/prevent-unload.svg)](https://www.npmjs.com/package/prevent-unload)\n[![Build Status](https://travis-ci.org/preco21/prevent-unload.svg?branch=master)](https://travis-ci.org/preco21/prevent-unload)\n[![Dependency Status](https://dependencyci.com/github/preco21/prevent-unload/badge)](https://dependencyci.com/github/preco21/prevent-unload)\n\n\u003e Prevent page unloading from the user's action\n\n## Install\n\n```bash\n$ npm install prevent-unload\n```\n\n## Usage\n\n```javascript\nimport preventUnload, {cancel} from 'prevent-unload';\n\nconst handler = preventUnload();\ncancel(handler);\n```\n\n## API\n\n### preventUnload([message])\n\n* `message` String (optional) - Message to display on confirm popup. Default is platform specified.\n\nApply page unloading prevention. If user attempt to close current web page after calling the method, then browser blocks page unloading and shows up popup with specified message.\n\nThis method returns reference of `handler`, which can be used for cancel the behavior.\n\n### preventUnload.cancel(handler)\n\n* `handler` Function - Handler reference to cancel event.\n\nCancel page unloading prevention.\n\n## License\n\n[MIT](http://preco.mit-license.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreco21%2Fprevent-unload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreco21%2Fprevent-unload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreco21%2Fprevent-unload/lists"}