{"id":18487051,"url":"https://github.com/mobilusoss/react-web-notification","last_synced_at":"2025-04-12T22:26:38.878Z","repository":{"id":33498234,"uuid":"37144116","full_name":"mobilusoss/react-web-notification","owner":"mobilusoss","description":"React component with HTML5 Web Notification API","archived":false,"fork":false,"pushed_at":"2023-01-03T18:22:12.000Z","size":4742,"stargazers_count":269,"open_issues_count":22,"forks_count":77,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T01:03:30.608Z","etag":null,"topics":["desktop-notification","notifications","react"],"latest_commit_sha":null,"homepage":"http://mobilusoss.github.io/react-web-notification","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/mobilusoss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-06-09T16:28:55.000Z","updated_at":"2025-03-15T18:45:50.000Z","dependencies_parsed_at":"2023-01-15T01:16:16.529Z","dependency_job_id":null,"html_url":"https://github.com/mobilusoss/react-web-notification","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilusoss%2Freact-web-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilusoss%2Freact-web-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilusoss%2Freact-web-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobilusoss%2Freact-web-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobilusoss","download_url":"https://codeload.github.com/mobilusoss/react-web-notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103296,"owners_count":20884024,"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":["desktop-notification","notifications","react"],"created_at":"2024-11-06T12:50:09.233Z","updated_at":"2025-04-04T02:04:33.028Z","avatar_url":"https://github.com/mobilusoss.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# React-web-notification [![Build Status](https://travis-ci.org/mobilusoss/react-web-notification.svg?branch=develop)](https://travis-ci.org/mobilusoss/react-web-notification) [![npm version](https://badge.fury.io/js/react-web-notification.svg)](http://badge.fury.io/js/react-web-notification) [![codebeat badge](https://codebeat.co/badges/e03e06fa-8d28-44a9-afb9-848cfcf98d91)](https://codebeat.co/projects/github-com-mobilusoss-react-web-notification-master) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmobilusoss%2Freact-web-notification.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmobilusoss%2Freact-web-notification?ref=badge_shield) [![codecov](https://codecov.io/gh/mobilusoss/react-web-notification/branch/master/graph/badge.svg)](https://codecov.io/gh/mobilusoss/react-web-notification)\n\nReact component with [HTML5 Web Notification API](https://developer.mozilla.org/en/docs/Web/API/notification).\nThis component show nothing in dom element, but trigger HTML5 Web Notification API with `render` method in the life cycle of React.js.\n\n## Demo\n\n[View Demo](https://mobilusoss.github.io/react-web-notification/example/)\n\n## Installation\n\n```bash\nnpm install --save react-web-notification\n```\n\n## API\n\n### `Notification`\n\nReact component which wrap web-notification.\n\n#### Props\n\n```javascript\nNotification.propTypes = {\n  ignore: bool,\n  disableActiveWindow: bool,\n  askAgain: bool,\n  notSupported: func,\n  onPermissionGranted: func,\n  onPermissionDenied: func,\n  onShow: func,\n  onClick: func,\n  onClose: func,\n  onError: func,\n  timeout: number,\n  title: string.isRequired,\n  options: object,\n  swRegistration: object,\n};\n\n```\n\n* `ignore` : if true, nothing will be happen\n\n* `disableActiveWindow` : if true, nothing will be happen when window is active\n\n* `askAgain` : if true, `window.Notification.requestPermission` will be called on `componentDidMount`, even if it was denied before,\n\n* `notSupported()` : Called when [HTML5 Web Notification API](https://developer.mozilla.org/en/docs/Web/API/notification) is not supported.\n\n* `onPermissionGranted()` : Called when permission granted.\n\n* `onPermissionDenied()` : Called when permission denied. `Notification` will do nothing until permission granted again.\n\n* `onShow(e, tag)` : Called when Desktop notification is shown.\n\n* `onClick(e, tag)` : Called when Desktop notification is clicked.\n\n* `onClose(e, tag)` : Called when Desktop notification is closed.\n\n* `onError(e, tag)` : Called when Desktop notification happen error.\n\n* `timeout` : milli sec to close notification automatically. Ignored if `0` or less. (Default `5000`)\n\n* `title` : Notification title.\n\n* `options` : Notification options. set `body`, `tag`, `icon` here.\n  See also (https://developer.mozilla.org/en-US/docs/Web/API/Notification/Notification)\n\n* `swRegistration` : ServiceWorkerRegistration. Use this prop to delegate the notification creation to a service worker.\n  See also (https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification)\n  ⚠️ `onShow`, `onClick`, `onClose` and `onError` handlers won't work when notification is created by the service worker.\n\n\n## Usage example\n\nSee  [example](https://github.com/mobilusoss/react-web-notification/tree/develop/example)\n\n```bash\nyarn\nyarn run start:example\n```\n\n## Tests\n\n```bash\nyarn test\n```\n\n## Update dependencies\n\nUse [npm-check-updates](https://www.npmjs.com/package/npm-check-updates)\n\n### Known Issues\n\n * [Notification.sound](https://github.com/mobilusoss/react-web-notification/issues/13)\n  `Notification.sound` is [not supported in any browser](https://developer.mozilla.org/en/docs/Web/API/notification/sound#Browser_compatibility).\n  You can emulate it with `onShow` callback. see [example](https://github.com/mobilusoss/react-web-notification/tree/develop/example).\n\n\n## License\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmobilusoss%2Freact-web-notification.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmobilusoss%2Freact-web-notification?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobilusoss%2Freact-web-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobilusoss%2Freact-web-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobilusoss%2Freact-web-notification/lists"}