MCPcopy
hub / github.com/angular/angular / doUnsubscribe

Method doUnsubscribe

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

thenMethod · 0.65
unsubscribeMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected