Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-web-notification

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-web-notification

AngularJS service for displaying web notifications.

  • 1.0.21
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
150
decreased by-18.03%
Maintainers
1
Weekly downloads
 
Created
Source

angular-web-notification

Bower Version NPM Version Build Status Coverage Status bitHound Code Inline docs
License Retire Status

Web Notifications AngularJS Service

Overview

The angular-web-notification is an angular service wrapper for the web notifications API.

It is using the HTML5-Desktop-Notifications library which provides a unified API for all browsers.

See W3 Specification and HTML5-Desktop-Notifications for more information.

Demo

Live Demo

Usage

In order to use the angular service you first must add the relevant dependencies:

<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="html5-desktop-notifications2/dist/Notification.js"></script>
<script type="text/javascript" src="angular-web-notification.js"></script>

Next you must define it as a dependency in your main angular module as follows:

angular.module('exampleApp', [
    'angular-web-notification'
]);

Now you can inject and use the service into your modules (directives/services/...), for example:

angular.module('exampleApp').directive('showButton', ['webNotification', function (webNotification) {
return {
    ...
    link: function (scope, element) {
        element.on('click', function onClick() {
            webNotification.showNotification('Example Notification', {
                body: 'Notification Text...',
                icon: 'my-icon.ico',
                onClick: function onNotificationClicked() {
                    console.log('Notification clicked.');
                },
                autoClose: 4000 //auto close the notification after 4 seconds (you can manually close it via hide function)
            }, function onShow(error, hide) {
                if (error) {
                    window.alert('Unable to show notification: ' + error.message);
                } else {
                    console.log('Notification Shown.');

                    setTimeout(function hideNotification() {
                        console.log('Hiding notification....');
                        hide(); //manually close the notification (you can skip this if you use the autoClose option)
                    }, 5000);
                }
            });
        });
    }
};
}]);

Installation

Run bower install in your project as follows:

bower install angular-web-notification --save

Or if you are using NPM to download client libraries, you can install it as follows:

npm install --save angular-web-notification

Limitations

The web notifications API is not fully supported in all browsers.

Please see supported browser versions for more information on the official spec support and at HTML5-Desktop-Notifications for more browser specific API support.

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

DateVersionDescription
2016-11-26v1.0.21Maintenance
2016-11-23v1.0.19Use forked version of html5-desktop-notifications in order to resolve few issues
2016-11-19v1.0.18Maintenance
2016-11-04v1.0.16Upgrading to html5-desktop-notifications 3.0.0
2016-10-16v1.0.15Maintenance
2016-09-10v1.0.6Default to website favicon.ico if icon not provided in options
2016-09-07v1.0.4Callback is now optional
2016-09-07v1.0.3Maintenance
2016-06-14v0.0.78Published via NPM (in addition to bower)
2016-06-14v0.0.77Maintenance
2016-03-08v0.0.65Added webNotification.permissionGranted attribute
2016-02-24v0.0.64Maintenance
2015-09-26v0.0.31Update bower dependencies
2015-09-26v0.0.30Added 'onClick' option to enable adding onclick event handler for the notification
2015-09-02v0.0.29Maintenance
2015-08-16v0.0.22uglify fix
2015-08-02v0.0.21Maintenance
2015-02-16v0.0.7Automatic unit tests via karma
2015-02-05v0.0.5Doc changes
2014-12-30v0.0.4Doc changes
2014-12-09v0.0.3API now enables/disables the capability to automatically request for permissions needed to display the notification.
2014-12-08v0.0.2Initial release

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.

Keywords

FAQs

Package last updated on 26 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc