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

option to defer until NetworkInformation type change #172

Open
jimmywarting opened this issue Jan 4, 2024 · 1 comment
Open

option to defer until NetworkInformation type change #172

jimmywarting opened this issue Jan 4, 2024 · 1 comment

Comments

@jimmywarting
Copy link

imagine a senario that you need to download or upload large data. you don't want users to use up all mobile data. so the solution would be to only do it when using wifi or ethernet network.

The solution i would wish for would be something like setting a connectionType for when the request should be initiated on:

/*
ConnectionType =
  | 'bluetooth'
  | 'cellular'
  | 'ethernet'
  | 'mixed'
  | 'none'
  | 'other'
  | 'unknown'
  | 'wifi'
  | 'wimax';
*/

const request = new Request('/upload', { body, method: 'POST' })

swReg.backgroundFetch.fetch(id, request, {
  // possible types: http://wicg.github.io/netinfo/#connection-types
  connectionType: ['wifi', 'ethernet']
})
@tomayac
Copy link

tomayac commented Jan 8, 2024

This sounds useful, and indeed should probably be modeled after the Network Information API's enums. It's fair to say that said API is Chrome-only and hasn't been adopted by other vendors.

To mitigate some of the other vendors' concerns, a while ago I proposed a reboot of the API, which likewise didn't get much love. Chrome is interested in exploring the reboot, but failed to find engineering resources so far.

Not sure where this leaves us…

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

No branches or pull requests

2 participants