MCPcopy Create free account
hub / github.com/angular/angular / doUnsubscribe

Method doUnsubscribe

packages/service-worker/src/push.ts:264–283  ·  view source on GitHub ↗
(sub: PushSubscription | null)

Source from the content-addressed store, hash-verified

262 }
263
264 const doUnsubscribe = (sub: PushSubscription | null) => {
265 if (sub === null) {
266 throw new RuntimeError(
267 RuntimeErrorCode.NOT_SUBSCRIBED_TO_PUSH_NOTIFICATIONS,
268 (typeof ngDevMode === 'undefined' || ngDevMode) &&
269 'Not subscribed to push notifications.',
270 );
271 }
272
273 return sub.unsubscribe().then((success) => {
274 if (!success) {
275 throw new RuntimeError(
276 RuntimeErrorCode.PUSH_SUBSCRIPTION_UNSUBSCRIBE_FAILED,
277 (typeof ngDevMode === 'undefined' || ngDevMode) && 'Unsubscribe failed!',
278 );
279 }
280
281 this.subscriptionChanges.next(null);
282 });
283 };
284
285 return new Promise((resolve, reject) => {
286 this.subscription

Callers

nothing calls this directly

Calls 3

thenMethod · 0.65
unsubscribeMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected