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

BackgroundSync - get queue length (WB-V4) #2011

Closed
bligny opened this issue Apr 5, 2019 · 2 comments
Closed

BackgroundSync - get queue length (WB-V4) #2011

bligny opened this issue Apr 5, 2019 · 2 comments

Comments

@bligny
Copy link

bligny commented Apr 5, 2019

We would like to regularly display the number of pending requests that are parked into workbox queue.

Yes I can use a custom "onSync" function in order to follow the play/replay of the queued items (and thereby increase/decrease an applicative counter), but the problem is that I need to initialize this counter on application/session startup.

I there a "workbox way" to query the workbox queue to get its length ?
(workbox way = not using indexeddb API to access the "request" store of the storage named "workbox-background-sync").

Thx in advance!

@bligny bligny changed the title BackgroundSync - get queue length BackgroundSync - get queue length (WB-V4) Apr 5, 2019
@philipwalton philipwalton self-assigned this Apr 5, 2019
@philipwalton
Copy link
Member

Thanks @bligny, this is not currently possible with the workbox-background-sync module, but it seems like a reasonable feature to add.

@Fitzchev
Copy link

Fitzchev commented Apr 8, 2019

What about going even further and be able to browse the pending requests to get the details? Something like myQueue.forEach(...). I guess we can use idb to do that (didn't try yet), but it would be cleaner to use the Queue object directly.

Use case:

In our app (used mostly offline) we have a menu entry called "Synchronizing" which display the number of items in queue (using a dedicated counter). It would be nice that a screen could display that list of pending items so that the user will know which one did not reach yet the backend server.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants