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

Provide extension points in order to add custom behavior to the service worker file generated by the angular cli. #21197

Open
balteo opened this issue Dec 28, 2017 · 3 comments
Assignees
Labels
area: service-worker Issues related to the @angular/service-worker package feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Milestone

Comments

@balteo
Copy link

balteo commented Dec 28, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

As of now, I can either register the angular-generated service worker (i.e. /ngsw-worker.js) or register my own custom service worker (see documentation: https://angular.io/api/service-worker/ServiceWorkerModule#static-members)

Expected behavior

One should be able to add custom behavior to angular-generated service workers (i.e. /ngsw-worker.js). For instance what if I want to add business logic to the service worker. It would be nice to provide extension points in order to achieve this and document them.

EDIT (gkalpak): Other related issues/issues that could be fixed by this: #24387, #26413, #30195, #46984

@balteo balteo changed the title Provide extension points in order to add custom behavior to service worker file generated by the angular cli. Provide extension points in order to add custom behavior to the service worker file generated by the angular cli. Dec 28, 2017
@alxhub alxhub added area: service-worker Issues related to the @angular/service-worker package feature Issue that requests a new feature labels Jan 2, 2018
@ngbot ngbot bot added this to the Backlog milestone Jan 23, 2018
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 5, 2021

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Jun 5, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 26, 2021

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@angular-robot angular-robot bot added the feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors label Jun 26, 2021
@gkalpak gkalpak added this to Inbox in Feature Requests Jul 5, 2021
@gkalpak gkalpak self-assigned this Sep 17, 2021
@petebacondarwin petebacondarwin moved this from Inbox to Needs Project Proposal in Feature Requests Sep 17, 2021
@jessicajaniuk jessicajaniuk added feature: under consideration Feature request for which voting has completed and the request is now under consideration and removed feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature: votes required Feature request which is currently still in the voting phase labels Jun 13, 2022
@yelhouti
Copy link

@jessicajaniuk thanks for marking this as under consideration, I would like to work on this to move it forward, I was thinking about integrating it with workbox, to avoid redundant work, there mechanism of registerRoute seems very well suited for this use case. And their code could be executed after checking dataGroups in:

if (this.adapter.normalizeUrl(req.url) !== this.indexUrl && this.isNavigationRequest(req)) {

It can even, IMO, replace the dataGroup implementation since AFAICT dataGroup is one of the uses cases covered by the caching startegies of workbox.

Also, once workbox is integrated, customisations could be as simple multiple calls of registerRoute in files referenced in angular.json

Other entrypoint can also be added later for uses cases that different from handling fetch events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: service-worker Issues related to the @angular/service-worker package feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Projects
No open projects
Feature Requests
Needs Project Proposal
Development

No branches or pull requests

5 participants