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