Skip to content

Commit c6a5fea

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents b1ef230 + f65f336 commit c6a5fea

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/notification.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class NotificationComponent implements OnInit, OnDestroy {
236236
return this.position !== 0 ? this.position * 90 : 0;
237237
}
238238

239-
onClick($e): void {
239+
onClick($e: any): void {
240240
this.item.click.emit($e);
241241

242242
if (this.clickToClose) {

src/push-notifications.service.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ declare const Notification: any;
77
@Injectable()
88
export class PushNotificationsService {
99

10-
permission: Permission = 'granted';
10+
permission: Permission;
11+
12+
constructor() {
13+
this.permission = this.isSupported() ? Notification.permission : 'denied';
14+
}
1115

1216
requestPermission() {
1317
if ('Notification' in window)
14-
Notification.requestPermission(status => this.permission = status);
18+
Notification.requestPermission((status: any) => this.permission = status);
1519
}
1620

1721
isSupported() {
@@ -20,31 +24,25 @@ export class PushNotificationsService {
2024

2125
create(title: string, options?: PushNotification): any {
2226

23-
return new Observable(obs => {
27+
return new Observable((obs: any) => {
2428

2529
if (!('Notification' in window)) {
26-
obs.error('Notifications are not available in this envirement');
30+
obs.error('Notifications are not available in this environment');
2731
obs.complete();
2832
}
2933

30-
this.permission = Notification.permission;
31-
3234
if (this.permission !== 'granted') {
33-
obs.error(`The user didn't granted you permission to send push notifications`);
35+
obs.error(`The user hasn't granted you permission to send push notifications`);
3436
obs.complete();
3537
}
3638

3739
const n = new Notification(title, options);
3840

39-
n.onshow = (e) => obs.next({notification: n, event: e});
40-
n.onclick = (e) => obs.next({notification: n, event: e});
41-
n.onerror = (e) => obs.error({notification: n, event: e});
41+
n.onshow = (e: any) => obs.next({notification: n, event: e});
42+
n.onclick = (e: any) => obs.next({notification: n, event: e});
43+
n.onerror = (e: any) => obs.error({notification: n, event: e});
4244
n.onclose = () => obs.complete();
43-
n.close = () => {
44-
n.close.bind(n);
45-
obs.complete();
46-
};
4745
});
4846
}
4947

50-
}
48+
}

0 commit comments

Comments
 (0)