{"id":20078090,"url":"https://github.com/quickblox/web-notifications","last_synced_at":"2025-05-05T22:31:57.049Z","repository":{"id":58228608,"uuid":"52260148","full_name":"QuickBlox/web-notifications","owner":"QuickBlox","description":"A library to help you with web notifications.","archived":false,"fork":false,"pushed_at":"2016-02-24T13:29:41.000Z","size":22,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-11T13:04:30.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuickBlox.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-02-22T08:56:01.000Z","updated_at":"2018-06-17T09:36:21.000Z","dependencies_parsed_at":"2022-08-31T08:21:42.700Z","dependency_job_id":null,"html_url":"https://github.com/QuickBlox/web-notifications","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickBlox%2Fweb-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickBlox%2Fweb-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickBlox%2Fweb-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickBlox%2Fweb-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuickBlox","download_url":"https://codeload.github.com/QuickBlox/web-notifications/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224470923,"owners_count":17316710,"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":[],"created_at":"2024-11-13T15:12:48.069Z","updated_at":"2024-11-13T15:12:48.795Z","avatar_url":"https://github.com/QuickBlox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# web-notifications (QBNotification)\n\n## Overview\n\nA wrapper for using the [Web Notifications API](https://www.w3.org/TR/notifications/).\n\nSee it in action in folder **test**\n\n[Browsers support see on caniuse](http://caniuse.com/#feat=notifications)\n\n## Install\n\nInstall the package via CDN\n```html\nhttps://cdn.rawgit.com/QuickBlox/web-notifications/master/qbNotification.js\n```\nor as NPM package\n```javascript\nnpm i web-notifications --save-dev\n```\nor as Bower component\n```javascript\nbower i web-notifications --save-dev\n```\n\n# Usage\nModule is written like Universal Module Definition, so use everywhere.\n\nBefore show a notification you need to get [permission](https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission) from a user by\n```javascript\nQBNotification.requestPermission(function(state) {\n    console.log('State is changed: ' + state);\n});\n```\nThen you should create instance of QBNotification.\n```javascript\n/**\n * @param {[string]} title [Title of notification. Required.]\n * @param {[type]} options [Additional options: standard params + timeout]\n */\nvar notify = new QBNotification(title, options);\n```\nExample options\n```javascript\nvar options = {\n    body: 'Body of notification',\n    tag: 'chatQB',\n    icons: 'image/icons.png',\n    timeout: 7,\n    closeOnClick: true\n}\n```\n\nThen you can show notification via\n```javascript\nnotify.show()\n```\nAlso you have:\n```javascript\n/**\n * [isSupported - check whether Notification API available in environment or not]\n * @return {Boolean} [flag]\n */\nQBNotification.isSupported()\n```\n\n```javascript\n/**\n * [needsPermission - check whether a user provided his permission to show notifications or not]\n * @return {Boolean} [flag]\n */\nQBNotification.needsPermission()\n```\n\n# Contribution\nFor test we use JSHint, so do\n```javascript\nnpm install -g jshint\nnpm test\n```\nbefore push yours changes.\n\n# Helpful links\n[W3](https://www.w3.org/TR/notifications/),\n[whatwg group](https://notifications.spec.whatwg.org/),\n[MDN](https://developer.mozilla.org/en/docs/Web/API/notification)\n\n# License\nBSD\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickblox%2Fweb-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquickblox%2Fweb-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickblox%2Fweb-notifications/lists"}