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

feat(service-worker): add function to provide service worker #48247

Closed

Conversation

jsaguet
Copy link
Contributor

@jsaguet jsaguet commented Nov 27, 2022

PR Type

What kind of change does this PR introduce?

  • Feature

What is the current behavior?

The only way to register a service worker is by using ServiceWorkerModule.register().
For standalone applications, we must use importProvidersFrom(ServiceWorkerModule.register(...)).

Issue Number: #47793

What is the new behavior?

This PR introduces a function provideServiceWorker to replace the call to ServiceWorkerModule.register() and hence avoid using NgModules to use service workers when building standalone applications.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from alxhub November 27, 2022 23:36
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Nov 27, 2022
@jsaguet jsaguet force-pushed the provide-service-worker-standalone branch 5 times, most recently from d5ccc65 to a6a079a Compare November 28, 2022 00:41
@jsaguet jsaguet changed the title feat(service-worker): adds function to provide service worker feat(service-worker): add function to provide service worker Nov 28, 2022
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsaguet thanks for creating this PR, it looks great! I've just left a few comments, please take a look when you get a chance. Thank you.

packages/service-worker/src/module.ts Show resolved Hide resolved
packages/service-worker/src/provider.ts Outdated Show resolved Hide resolved
packages/service-worker/src/provider.ts Show resolved Hide resolved
packages/service-worker/src/provider.ts Show resolved Hide resolved
packages/service-worker/test/provider_spec.ts Show resolved Hide resolved
@AndrewKushnir AndrewKushnir added feature Issue that requests a new feature action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release area: service-worker Issues related to the @angular/service-worker package labels Nov 29, 2022
@ngbot ngbot bot added this to the Backlog milestone Nov 29, 2022
@jsaguet jsaguet force-pushed the provide-service-worker-standalone branch 5 times, most recently from f885794 to c8d8ad4 Compare December 1, 2022 10:01
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsaguet the changes look good, thanks for addressing the feedback! I'm adding an approval, but since this PR touches public API, it'd require a couple more reviews (you may receive some extra feedback). Thank you.

@AndrewKushnir
Copy link
Contributor

@alxhub FYI this PR would require your review, since I'm not a part of fw-service-worker group in PullApprove.

add function `provideServiceWorker` to register a service worker in standalone applications without using `ServiceWorkerModule.register()`
@jsaguet jsaguet force-pushed the provide-service-worker-standalone branch from c8d8ad4 to fb67f8a Compare March 4, 2023 16:43
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed-for: public-api

@AndrewKushnir AndrewKushnir removed the request for review from alxhub March 9, 2023 18:07
@pullapprove pullapprove bot requested a review from alxhub March 9, 2023 18:07
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 9, 2023
@AndrewKushnir
Copy link
Contributor

Caretaker note: this PR is ready for merge. There are no changes to the underlying ServiceWorker logic, the change is more about exposing a new public API (standalone version of the API to enable ServiceWorker integration).

@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit 5e7fc25.

@AndrewKushnir
Copy link
Contributor

@jsaguet thanks again for creating this PR and addressing the feedback! 👍

This PR is now merged and will be released as a part of the upcoming v16 in a few weeks.

JeanMeche pushed a commit to JeanMeche/angular that referenced this pull request Mar 12, 2023
…#48247)

add function `provideServiceWorker` to register a service worker in standalone applications without using `ServiceWorkerModule.register()`

PR Close angular#48247
JeanMeche pushed a commit to JeanMeche/angular that referenced this pull request Mar 12, 2023
…#48247)

add function `provideServiceWorker` to register a service worker in standalone applications without using `ServiceWorkerModule.register()`

PR Close angular#48247
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: service-worker Issues related to the @angular/service-worker package detected: feature PR contains a feature commit feature Issue that requests a new feature merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants