Skip to content

option to only sync when connected to wifi / metered network #191

@jimmywarting

Description

@jimmywarting

Going to reference this issue: WICG/background-fetch#172

Essentially: I only want to download songs for offline use when i'm connected to internet with unlimited data plan (otherwise i will play already downloaded songs that i have stored already)

triggering sync when being online or periodic dose not cut it for me... i want to be friendly towards the clients data cost and save money

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

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

registration.sync.register('download-song', {
  // possible types: http://wicg.github.io/netinfo/#connection-types
  onlyOnConnectionType: ['wifi', 'ethernet'],
  onlyOnMetered: true
})

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