Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Navigator.serviceWorker from inside the app #10511

Closed
theunreal opened this issue Feb 21, 2017 · 2 comments
Closed

Access Navigator.serviceWorker from inside the app #10511

theunreal opened this issue Feb 21, 2017 · 2 comments

Comments

@theunreal
Copy link

theunreal commented Feb 21, 2017

Ionic version: (check one with "x")
[ ] 1.x
[ x] 2.x

I'm submitting a ... (check one with "x")
[ ] bug report
[x ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When trying to access Navigator.serviceWorker() from inside the app (any .ts file such as app.component.ts), I get the following error:

Property 'serviceWorker' does not exist on type 'Navigator'.

Expected behavior:
property serviceWorker exists and also imported by ionic 2 using sw-toolbox, why I can access it only from the index.html as mentioned in the documentation. Why I can't access the service worker from inside my app?

Related code:

if ('serviceWorker' in navigator && 'PushManager' in window) {
      console.log(navigator.serviceWorker);

Other information:
May be releated: microsoft/TypeScript#11781

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed
@jgw96
Copy link
Contributor

jgw96 commented Feb 21, 2017

Hello! Thanks for opening an issue with us! As this seems like more of a support question i will urge that you ask this question on our forum or on our slack channel. Thanks for using Ionic!

@jgw96 jgw96 closed this as completed Feb 21, 2017
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 4, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants