Re: [permissions] Should we add a global change event? (#15)

I think that having such global event will end up with developers doing:
```js
PERMISSIONS.onchange = function(e) {
  if (e.permission === "") {
  } else if (...) {
  }
};
```

Also, it would be very hard for extensibility. With the ```.query()``` model, the UA knows what kind of permission is being listened to which makes the change event doable.

If the following called was made:
```js
Permissions.query({'name': 'quota', 'quota': '30M'}).then(function(p) {
  p.onchange = function() {
    if (p.status === 'granted') {
      // access to 30M quota minimum
    }
  };
});
```
It is obvious for the UA to know that an even should be fired if the quota is changed below or above 30M.

With a global change event, what should happen if the quota changes from 25M to 35M? What if the user changed their preference so the page has to query to get more than 30M but granted automatically for less. It would also deny automatically any request above 50M. Is that three change events? It seems uterly complicated to specify for no clear use cases.

Also, as an implementer, a global change means higher resource usage.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/permissions/issues/15#issuecomment-82297234

Received on Tuesday, 17 March 2015 11:41:47 UTC