Skip to content

Commit 48e313e

Browse files
committed
update demo
1 parent 621cced commit 48e313e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/example/example.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ window.angular.module('exampleApp', [
1111
}]).directive('showButton', ['webNotification', function (webNotification) {
1212
'use strict';
1313

14+
var serviceWorkerRegistration;
15+
16+
if (navigator.serviceWorker) {
17+
navigator.serviceWorker.register('service-worker.js').then(function (registration) {
18+
serviceWorkerRegistration = registration;
19+
});
20+
}
21+
1422
return {
1523
restrict: 'C',
1624
scope: {
@@ -20,6 +28,7 @@ window.angular.module('exampleApp', [
2028
link: function (scope, element) {
2129
element.on('click', function onClick() {
2230
webNotification.showNotification(scope.notificationTitle, {
31+
serviceWorkerRegistration: serviceWorkerRegistration,
2332
body: scope.notificationText,
2433
onClick: function onNotificationClicked() {
2534
console.log('Notification clicked.');

docs/service-worker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
self.addEventListener('install', function(event) {});

0 commit comments

Comments
 (0)