Commit c4983d0d authored by mvanouwerkerk's avatar mvanouwerkerk Committed by Commit bot

Push API: rename to endpoint and registrationId. [1/3]

This is part of a series:
[1] This CL
[2] https://codereview.chromium.org/795153003/
[3] https://codereview.chromium.org/802393002/

BUG=442343

Review URL: https://codereview.chromium.org/805863002

Cr-Commit-Position: refs/heads/master@{#308399}
parent ef924a9c
......@@ -83,26 +83,29 @@ function removeManifest() {
if (element) {
element.parentNode.removeChild(element);
sendResultToTest('manifest removed');
} else
} else {
sendResultToTest('unable to find manifest element');
}
}
function registerPush() {
navigator.serviceWorker.ready.then(function(swRegistration) {
// TODO(mvanouwerkerk): Cleanup once the final API is exposed.
var pushManager = swRegistration.pushManager || navigator.push;
return pushManager.register().then(function(pushRegistration) {
sendResultToTest(pushRegistration.pushEndpoint + ' - ' +
pushRegistration.pushRegistrationId);
return swRegistration.pushManager.register()
.then(function(pushRegistration) {
// TODO: Cleanup once the final API is exposed.
var endpoint = pushRegistration.endpoint ||
pushRegistration.pushEndpoint;
var registrationId = pushRegistration.registrationId ||
pushRegistration.pushRegistrationId;
sendResultToTest(endpoint + ' - ' + registrationId);
});
}).catch(sendErrorToTest);
}
function hasPermission() {
navigator.serviceWorker.ready.then(function(swRegistration) {
// TODO(mvanouwerkerk): Cleanup once the final API is exposed.
var pushManager = swRegistration.pushManager || navigator.push;
return pushManager.hasPermission().then(function(permission) {
return swRegistration.pushManager.hasPermission()
.then(function(permission) {
sendResultToTest('permission status - ' + permission);
});
}).catch(sendErrorToTest);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment