taiga-family / ng-web-apis

A set of common utils for consuming Web APIs with Angular

Home Page:https://taiga-family.github.io/ng-web-apis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Add support to Notification API and PushManager API

AniramOcean opened this issue Β· comments

πŸš€ Feature request

Is your feature request related to a problem?

I'm always frustrated when I need to use the Notification API and PushManager API in the ng-web-apis. The library currently lacks support for these APIs. This forces me to make some workarounds, using non-ideal techniques.

Describe the solution you'd like

I'd like to request the addition of support for the Notification API and PushManager API in the library. It would be cool if these APIs could be accessed through an injectable token in the constructor like a NAVIGATOR or a WINDOW, that allows for more maintainable code.

Describe alternatives you've considered

I'm currently using the makeshift approach:

constructor(@Inject(WINDOW) private readonly window: Window) {}

//  acces PushManager API
this.window['PushManager']

// check Notification API support
windowNotification = 'Notification' in this.window || this.window['Notification'];

However, this workaround bypasses the advantages of dependency injection and can lead to less maintainable code.