Skip to content

option to defer until NetworkInformation type change #172

Open
@jimmywarting

Description

@jimmywarting

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']
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions