|
42 | 42 | }(this, function initWebNotification(NotifyLib) { |
43 | 43 | 'use strict'; |
44 | 44 |
|
45 | | - var service = {}; |
| 45 | + var webNotification = {}; |
46 | 46 |
|
47 | 47 | /** |
48 | 48 | * The internal Notification library used by this library. |
|
51 | 51 | * @alias webNotification.lib |
52 | 52 | * @private |
53 | 53 | */ |
54 | | - service.lib = NotifyLib; |
| 54 | + webNotification.lib = NotifyLib; |
55 | 55 |
|
56 | 56 | /** |
57 | 57 | * True to enable automatic requesting of permissions if needed. |
|
61 | 61 | * @alias webNotification.allowRequest |
62 | 62 | * @public |
63 | 63 | */ |
64 | | - service.allowRequest = true; //true to enable automatic requesting of permissions if needed |
| 64 | + webNotification.allowRequest = true; //true to enable automatic requesting of permissions if needed |
65 | 65 |
|
66 | 66 | /*eslint-disable func-name-matching*/ |
67 | | - Object.defineProperty(service, 'permissionGranted', { |
| 67 | + Object.defineProperty(webNotification, 'permissionGranted', { |
68 | 68 | /** |
69 | 69 | * Returns the permission granted value. |
70 | 70 | * |
|
116 | 116 | * @returns {Boolean} True if allowed to show web notifications |
117 | 117 | */ |
118 | 118 | var isEnabled = function () { |
119 | | - return service.permissionGranted; |
| 119 | + return webNotification.permissionGranted; |
120 | 120 | }; |
121 | 121 |
|
122 | 122 | /** |
|
246 | 246 | * }); |
247 | 247 | * ``` |
248 | 248 | */ |
249 | | - service.showNotification = function () { |
| 249 | + webNotification.showNotification = function () { |
250 | 250 | //convert to array to enable modifications |
251 | 251 | var argumentsArray = Array.prototype.slice.call(arguments, 0); |
252 | 252 |
|
|
262 | 262 | if (isEnabled()) { |
263 | 263 | hideNotification = createAndDisplayNotification(title, options); |
264 | 264 | callback(null, hideNotification); |
265 | | - } else if (service.allowRequest) { |
| 265 | + } else if (webNotification.allowRequest) { |
266 | 266 | NotifyLib.requestPermission(function onRequestDone() { |
267 | 267 | if (isEnabled()) { |
268 | 268 | hideNotification = createAndDisplayNotification(title, options); |
|
277 | 277 | } |
278 | 278 | }; |
279 | 279 |
|
280 | | - return service; |
| 280 | + return webNotification; |
281 | 281 | })); |
0 commit comments