Skip to content

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

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

Activity

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

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