Also extend the data clear telemetry, which is also relevant for DWP as one of the arguments was that DWP subscription should not be cleared with other data as long as the permission exists. Differential Revision: https://phabricator.services.mozilla.com/D274428
21 lines
465 B
JavaScript
21 lines
465 B
JavaScript
async function postAll(data) {
|
|
const clients = await self.clients.matchAll({ includeUncontrolled: true });
|
|
for (const client of clients) {
|
|
client.postMessage(data);
|
|
}
|
|
}
|
|
|
|
onpush = ev => postAll({
|
|
type: ev.type,
|
|
data: ev.data.text(),
|
|
});
|
|
|
|
onpushsubscriptionchange = ev => {
|
|
postAll({
|
|
type: ev.type,
|
|
constructor: ev.constructor.name,
|
|
oldSubscription: ev.oldSubscription?.toJSON(),
|
|
newSubscription: ev.newSubscription?.toJSON(),
|
|
});
|
|
}
|