source: trip-planner-front/node_modules/rxjs/internal/Subscription.d.ts@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[6a3a178]1import { SubscriptionLike, TeardownLogic } from './types';
2/**
3 * Represents a disposable resource, such as the execution of an Observable. A
4 * Subscription has one important method, `unsubscribe`, that takes no argument
5 * and just disposes the resource held by the subscription.
6 *
7 * Additionally, subscriptions may be grouped together through the `add()`
8 * method, which will attach a child Subscription to the current Subscription.
9 * When a Subscription is unsubscribed, all its children (and its grandchildren)
10 * will be unsubscribed as well.
11 *
12 * @class Subscription
13 */
14export declare class Subscription implements SubscriptionLike {
15 /** @nocollapse */
16 static EMPTY: Subscription;
17 /**
18 * A flag to indicate whether this Subscription has already been unsubscribed.
19 * @type {boolean}
20 */
21 closed: boolean;
22 /** @internal */
23 protected _parentOrParents: Subscription | Subscription[];
24 /** @internal */
25 private _subscriptions;
26 /**
27 * @param {function(): void} [unsubscribe] A function describing how to
28 * perform the disposal of resources when the `unsubscribe` method is called.
29 */
30 constructor(unsubscribe?: () => void);
31 /**
32 * Disposes the resources held by the subscription. May, for instance, cancel
33 * an ongoing Observable execution or cancel any other type of work that
34 * started when the Subscription was created.
35 * @return {void}
36 */
37 unsubscribe(): void;
38 /**
39 * Adds a tear down to be called during the unsubscribe() of this
40 * Subscription. Can also be used to add a child subscription.
41 *
42 * If the tear down being added is a subscription that is already
43 * unsubscribed, is the same reference `add` is being called on, or is
44 * `Subscription.EMPTY`, it will not be added.
45 *
46 * If this subscription is already in an `closed` state, the passed
47 * tear down logic will be executed immediately.
48 *
49 * When a parent subscription is unsubscribed, any child subscriptions that were added to it are also unsubscribed.
50 *
51 * @param {TeardownLogic} teardown The additional logic to execute on
52 * teardown.
53 * @return {Subscription} Returns the Subscription used or created to be
54 * added to the inner subscriptions list. This Subscription can be used with
55 * `remove()` to remove the passed teardown logic from the inner subscriptions
56 * list.
57 */
58 add(teardown: TeardownLogic): Subscription;
59 /**
60 * Removes a Subscription from the internal list of subscriptions that will
61 * unsubscribe during the unsubscribe process of this Subscription.
62 * @param {Subscription} subscription The subscription to remove.
63 * @return {void}
64 */
65 remove(subscription: Subscription): void;
66}
Note: See TracBrowser for help on using the repository browser.