Skip to content

Commit 604ce27

Browse files
committed
docs
1 parent 5f10d26 commit 604ce27

File tree

6 files changed

+45
-67
lines changed

6 files changed

+45
-67
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ See [contributing guide](.github/CONTRIBUTING.md)
109109

110110
| Date | Version | Description |
111111
| ----------- | ------- | ----------- |
112+
| 2017-01-22 | v1.2.1 | Maintenance |
112113
| 2017-01-22 | v1.2.0 | Split the internal web notification API into a new project: simple-web-notification |
113114
| 2017-01-13 | v1.0.26 | Maintenance |
114115
| 2016-11-23 | v1.0.19 | Use forked version of html5-desktop-notifications in order to resolve few issues |

angular-web-notification.js

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,48 @@
2323
* @returns {Object} The service instance
2424
*
2525
* @description
26-
* The web notification service wraps the HTML 5 Web Notifications API as an angular service.<br>
27-
* See [simple-web-notification](https://github.com/sagiegurari/simple-web-notification/blob/master/docs/api.md) for detailed API.
28-
*
29-
* @example
30-
* ```js
31-
* angular.module('exampleApp').directive('showButton', ['webNotification', function (webNotification) {
32-
* return {
33-
* link: function (scope, element) {
34-
* element.on('click', function onClick() {
35-
* webNotification.showNotification('Example Notification', {
36-
* body: 'Notification Text...',
37-
* icon: 'my-icon.ico',
38-
* onClick: function onNotificationClicked() {
39-
* console.log('Notification clicked.');
40-
* },
41-
* autoClose: 4000 //auto close the notification after 4 seconds (you can manually close it via hide function)
42-
* }, function onShow(error, hide) {
43-
* if (error) {
44-
* window.alert('Unable to show notification: ' + error.message);
45-
* } else {
46-
* console.log('Notification Shown.');
47-
*
48-
* setTimeout(function hideNotification() {
49-
* console.log('Hiding notification....');
50-
* hide(); //manually close the notification (you can skip this if you use the autoClose option)
51-
* }, 5000);
52-
* }
53-
* });
54-
* });
55-
* }
56-
* };
57-
* }]);
58-
* ```
26+
* The web notification service wraps the HTML 5 Web Notifications API as an angular service.
5927
*/
6028
webNotification.factory('webNotification', function onCreateService() {
29+
/**
30+
* Shows the notification based on the provided input.<br>
31+
* The callback invoked will get an error object (in case of an error, null in
32+
* case of no errors) and a 'hide' function which can be used to hide the notification.
33+
*
34+
* @function
35+
* @memberof! webNotification
36+
* @alias webNotification.showNotification
37+
* @public
38+
* @param {String} [title] - The notification title text (defaulted to empty string if null is provided)
39+
* @param {Object} [options] - Holds the notification data (web notification API spec for more info)
40+
* @param {String} [options.icon=/favicon.ico] - The notification icon (defaults to the website favicon.ico)
41+
* @param {Number} [options.autoClose] - Auto closes the notification after the provided amount of millies (0 or undefined for no auto close)
42+
* @param {function} [options.onClick] - An optional onclick event handler
43+
* @param {ShowNotificationCallback} [callback] - Called after the show is handled.
44+
* @example
45+
* ```js
46+
* webNotification.showNotification('Example Notification', {
47+
* body: 'Notification Text...',
48+
* icon: 'my-icon.ico',
49+
* onClick: function onNotificationClicked() {
50+
* console.log('Notification clicked.');
51+
* },
52+
* autoClose: 4000 //auto close the notification after 4 seconds (you can manually close it via hide function)
53+
* }, function onShow(error, hide) {
54+
* if (error) {
55+
* window.alert('Unable to show notification: ' + error.message);
56+
* } else {
57+
* console.log('Notification Shown.');
58+
*
59+
* setTimeout(function hideNotification() {
60+
* console.log('Hiding notification....');
61+
* hide(); //manually close the notification (you can skip this if you use the autoClose option)
62+
* }, 5000);
63+
* }
64+
* });
65+
* ```
66+
*/
67+
6168
return webNotificationAPI;
6269
});
6370
}(window.webNotification));

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-web-notification",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "AngularJS service for displaying web notifications.",
55
"authors": [
66
"Sagie Gur-Ari <sagiegurari@gmail.com>"

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| Date | Version | Description |
22
| ----------- | ------- | ----------- |
3+
| 2017-01-22 | v1.2.1 | Maintenance |
34
| 2017-01-22 | v1.2.0 | Split the internal web notification API into a new project: simple-web-notification |
45
| 2017-01-13 | v1.0.26 | Maintenance |
56
| 2016-11-23 | v1.0.19 | Use forked version of html5-desktop-notifications in order to resolve few issues |

docs/api.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,9 @@
11
<a name="webNotification"></a>
22

33
## webNotification ⇒ <code>Object</code>
4-
The web notification service wraps the HTML 5 Web Notifications API as an angular service.<br>
5-
See [simple-web-notification](https://github.com/sagiegurari/simple-web-notification/blob/master/docs/api.md) for detailed API.
4+
The web notification service wraps the HTML 5 Web Notifications API as an angular service.
65

76
**Kind**: global namespace
87
**Returns**: <code>Object</code> - The service instance
98
**Ngdoc**: service
109
**Author:** Sagie Gur-Ari
11-
**Example**
12-
```js
13-
angular.module('exampleApp').directive('showButton', ['webNotification', function (webNotification) {
14-
return {
15-
link: function (scope, element) {
16-
element.on('click', function onClick() {
17-
webNotification.showNotification('Example Notification', {
18-
body: 'Notification Text...',
19-
icon: 'my-icon.ico',
20-
onClick: function onNotificationClicked() {
21-
console.log('Notification clicked.');
22-
},
23-
autoClose: 4000 //auto close the notification after 4 seconds (you can manually close it via hide function)
24-
}, function onShow(error, hide) {
25-
if (error) {
26-
window.alert('Unable to show notification: ' + error.message);
27-
} else {
28-
console.log('Notification Shown.');
29-
30-
setTimeout(function hideNotification() {
31-
console.log('Hiding notification....');
32-
hide(); //manually close the notification (you can skip this if you use the autoClose option)
33-
}, 5000);
34-
}
35-
});
36-
});
37-
}
38-
};
39-
}]);
40-
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-web-notification",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "AngularJS service for displaying web notifications.",
55
"author": {
66
"name": "Sagie Gur-Ari",

0 commit comments

Comments
 (0)