@artstesh/postboy 3.1.3 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
import { Observable, Subject } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* A class that manages a reactive subscription using a provided Subject and transformation pipe.
|
|
4
|
+
* Offers methods to interact with the subscription, such as emitting data, completing the subscription,
|
|
5
|
+
* and accessing the transformed observable.
|
|
6
|
+
*
|
|
7
|
+
* @template T The type of data managed by the subscription.
|
|
8
|
+
*/
|
|
2
9
|
export declare class PostboySubscription<T> {
|
|
3
10
|
private subscription;
|
|
4
|
-
private
|
|
11
|
+
private readonly _subscription;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs an instance of the class with a given subscription and a transformation pipe.
|
|
14
|
+
*
|
|
15
|
+
* @param {Subject<T>} subscription - The source Subject that will be transformed.
|
|
16
|
+
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation to the subscription.
|
|
17
|
+
*/
|
|
5
18
|
constructor(subscription: Subject<T>, pipe: (s: Subject<T>) => Observable<T>);
|
|
19
|
+
/**
|
|
20
|
+
* Returns an observable subscription.
|
|
21
|
+
*
|
|
22
|
+
* @return {Observable<T>} An observable instance of type T.
|
|
23
|
+
*/
|
|
6
24
|
sub(): Observable<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Triggers an event by emitting the provided data to all subscribers.
|
|
27
|
+
*
|
|
28
|
+
* @param {T} data - The data to emit to the subscribers.
|
|
29
|
+
* @return {void} - Does not return any value.
|
|
30
|
+
*/
|
|
7
31
|
fire(data: T): void;
|
|
32
|
+
/**
|
|
33
|
+
* Completes the subscription, signaling that no further values will be sent.
|
|
34
|
+
* This is typically used to finalize or clean up resources.
|
|
35
|
+
* @return {void} This method does not return any value.
|
|
36
|
+
*/
|
|
8
37
|
finish(): void;
|
|
9
38
|
}
|
|
10
39
|
//# sourceMappingURL=postboy-subscription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-subscription.d.ts","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3C,qBAAa,mBAAmB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"postboy-subscription.d.ts","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3C;;;;;;GAMG;AACH,qBAAa,mBAAmB,CAAC,CAAC;IAU9B,OAAO,CAAC,YAAY;IATtB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAE9C;;;;;OAKG;gBAEO,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,EAChC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;IAKxC;;;;OAIG;IACI,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC;IAI3B;;;;;OAKG;IACI,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAI1B;;;;OAIG;IACI,MAAM,IAAI,IAAI;CAGtB"}
|
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PostboySubscription = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A class that manages a reactive subscription using a provided Subject and transformation pipe.
|
|
6
|
+
* Offers methods to interact with the subscription, such as emitting data, completing the subscription,
|
|
7
|
+
* and accessing the transformed observable.
|
|
8
|
+
*
|
|
9
|
+
* @template T The type of data managed by the subscription.
|
|
10
|
+
*/
|
|
4
11
|
class PostboySubscription {
|
|
12
|
+
/**
|
|
13
|
+
* Constructs an instance of the class with a given subscription and a transformation pipe.
|
|
14
|
+
*
|
|
15
|
+
* @param {Subject<T>} subscription - The source Subject that will be transformed.
|
|
16
|
+
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation to the subscription.
|
|
17
|
+
*/
|
|
5
18
|
constructor(subscription, pipe) {
|
|
6
19
|
this.subscription = subscription;
|
|
7
|
-
this.
|
|
20
|
+
this._subscription = pipe(subscription);
|
|
8
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns an observable subscription.
|
|
24
|
+
*
|
|
25
|
+
* @return {Observable<T>} An observable instance of type T.
|
|
26
|
+
*/
|
|
9
27
|
sub() {
|
|
10
|
-
return this.
|
|
28
|
+
return this._subscription;
|
|
11
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Triggers an event by emitting the provided data to all subscribers.
|
|
32
|
+
*
|
|
33
|
+
* @param {T} data - The data to emit to the subscribers.
|
|
34
|
+
* @return {void} - Does not return any value.
|
|
35
|
+
*/
|
|
12
36
|
fire(data) {
|
|
13
37
|
this.subscription.next(data);
|
|
14
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Completes the subscription, signaling that no further values will be sent.
|
|
41
|
+
* This is typically used to finalize or clean up resources.
|
|
42
|
+
* @return {void} This method does not return any value.
|
|
43
|
+
*/
|
|
15
44
|
finish() {
|
|
16
45
|
this.subscription.complete();
|
|
17
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-subscription.js","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"postboy-subscription.js","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAa,mBAAmB;IAG9B;;;;;OAKG;IACH,YACU,YAAwB,EAChC,IAAsC;QAD9B,iBAAY,GAAZ,YAAY,CAAY;QAGhC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,GAAG;QACR,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,IAAO;QACjB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,MAAM;QACX,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;CACF;AA3CD,kDA2CC"}
|