evg_observable 1.0.2 → 1.0.7
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.
- package/package.json +1 -1
- package/src/Libraries/Observables/OrderedObservable.ts +39 -2
- package/src/Libraries/Observables/Types.ts +37 -8
- package/src/outLib/Observables/OrderedObservable.d.ts +10 -3
- package/src/outLib/Observables/OrderedObservable.js +20 -2
- package/src/outLib/Observables/OrderedObservable.js.map +1 -1
- package/src/outLib/Observables/Types.d.ts +23 -0
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import {Observable, SubscribeObject} from "./Observable";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ICallback,
|
|
4
|
+
IListener,
|
|
5
|
+
IObserver,
|
|
6
|
+
IOrdered,
|
|
7
|
+
IOrderedObservable,
|
|
8
|
+
IOrderedSetup,
|
|
9
|
+
IOrderedSubscribe,
|
|
10
|
+
IOrderedSubscriptionLike
|
|
11
|
+
} from "./Types";
|
|
3
12
|
|
|
4
13
|
export class OrderedSubscribeObject<T> extends SubscribeObject<T> {
|
|
14
|
+
constructor(observable: OrderedObservable<T> | IOrdered<T>, listener?: IListener<T>) {
|
|
15
|
+
super(<IObserver<T>>observable, listener);
|
|
16
|
+
}
|
|
17
|
+
|
|
5
18
|
get order(): number {
|
|
6
19
|
return this._order;
|
|
7
20
|
}
|
|
@@ -20,10 +33,34 @@ export class OrderedSubscribeObject<T> extends SubscribeObject<T> {
|
|
|
20
33
|
this.listener = listener;
|
|
21
34
|
return this;
|
|
22
35
|
}
|
|
36
|
+
|
|
37
|
+
setOnce(): IOrderedSubscribe<T> {
|
|
38
|
+
return <any>super.setOnce();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
unsubscribeByNegative(condition: ICallback<any>): IOrderedSubscribe<T> {
|
|
42
|
+
return <any>super.unsubscribeByNegative(condition);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
unsubscribeByPositive(condition: ICallback<any>): IOrderedSubscribe<T> {
|
|
46
|
+
return <any>super.unsubscribeByPositive(condition);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
emitByNegative(condition: ICallback<any>): IOrderedSubscribe<T> {
|
|
50
|
+
return <any>super.emitByNegative(condition);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
emitByPositive(condition: ICallback<any>): IOrderedSubscribe<T> {
|
|
54
|
+
return <any>super.emitByPositive(condition);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
emitMatch(condition: ICallback<any>): IOrderedSubscribe<T> {
|
|
58
|
+
return <any>super.emitMatch(condition);
|
|
59
|
+
}
|
|
23
60
|
}
|
|
24
61
|
|
|
25
62
|
export class OrderedObservable<T>
|
|
26
|
-
extends Observable<T> implements
|
|
63
|
+
extends Observable<T> implements IOrdered<T> {
|
|
27
64
|
sortByOrder(): void {
|
|
28
65
|
if (this._isDestroyed) return undefined;
|
|
29
66
|
this.listeners.sort((a, b) => {
|
|
@@ -24,6 +24,10 @@ export type IOnce<T> = {
|
|
|
24
24
|
setOnce(): ISubscribe<T>;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
export type IOrderedOnce<T> = {
|
|
28
|
+
setOnce(): IOrderedSubscribe<T>;
|
|
29
|
+
};
|
|
30
|
+
|
|
27
31
|
export type ISetObservableValue = {
|
|
28
32
|
next(value: any): void;
|
|
29
33
|
};
|
|
@@ -42,13 +46,13 @@ export type ISetup<T> =
|
|
|
42
46
|
ISubscribe<T>;
|
|
43
47
|
|
|
44
48
|
export type IOrderedSetup<T> =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
IOrderedUnsubscribeByNegative<T> &
|
|
50
|
+
IOrderedUnsubscribeByPositive<T> &
|
|
51
|
+
IOrderedEmitByNegative<T> &
|
|
52
|
+
IOrderedEmitByPositive<T> &
|
|
53
|
+
IOrderedEmitMatchCondition<T> &
|
|
54
|
+
IOrderedOnce<T> &
|
|
55
|
+
IOrderedSubscribe<T>;
|
|
52
56
|
|
|
53
57
|
export type ISubscribeObject<T> =
|
|
54
58
|
ISubscriptionLike<T> &
|
|
@@ -98,22 +102,42 @@ export type IUnsubscribeByNegative<T> = {
|
|
|
98
102
|
unsubscribeByNegative(condition: ICallback<any>): ISubscribe<T>;
|
|
99
103
|
};
|
|
100
104
|
|
|
105
|
+
export type IOrderedUnsubscribeByNegative<T> = {
|
|
106
|
+
unsubscribeByNegative(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
107
|
+
};
|
|
108
|
+
|
|
101
109
|
export type IUnsubscribeByPositive<T> = {
|
|
102
110
|
unsubscribeByPositive(condition: ICallback<any>): ISubscribe<T>;
|
|
103
111
|
};
|
|
104
112
|
|
|
113
|
+
export type IOrderedUnsubscribeByPositive<T> = {
|
|
114
|
+
unsubscribeByPositive(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
115
|
+
};
|
|
116
|
+
|
|
105
117
|
export type IEmitByNegative<T> = {
|
|
106
118
|
emitByNegative(condition: ICallback<any>): ISubscribe<T>;
|
|
107
119
|
};
|
|
108
120
|
|
|
121
|
+
export type IOrderedEmitByNegative<T> = {
|
|
122
|
+
emitByNegative(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
123
|
+
};
|
|
124
|
+
|
|
109
125
|
export type IEmitByPositive<T> = {
|
|
110
126
|
emitByPositive(condition: ICallback<any>): ISubscribe<T>;
|
|
111
127
|
};
|
|
112
128
|
|
|
129
|
+
export type IOrderedEmitByPositive<T> = {
|
|
130
|
+
emitByPositive(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
131
|
+
};
|
|
132
|
+
|
|
113
133
|
export type IEmitMatchCondition<T> = {
|
|
114
134
|
emitMatch(condition: ICallback<any>): ISubscribe<T>;
|
|
115
135
|
};
|
|
116
136
|
|
|
137
|
+
export type IOrderedEmitMatchCondition<T> = {
|
|
138
|
+
emitMatch(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
139
|
+
};
|
|
140
|
+
|
|
117
141
|
export type ICollector =
|
|
118
142
|
IDestroy &
|
|
119
143
|
ISubscribeCounter &
|
|
@@ -127,4 +151,9 @@ export type IOrderedObservable = {
|
|
|
127
151
|
sortByOrder(): void;
|
|
128
152
|
};
|
|
129
153
|
|
|
130
|
-
export type
|
|
154
|
+
export type IOrdered<T> = IObserver<T> & IOrderedObservable;
|
|
155
|
+
|
|
156
|
+
export type IOrderedSubscriptionLike<T> = ISubscriptionLike<T> & IOrder;
|
|
157
|
+
export type IOrderedSubscribe<T> = {
|
|
158
|
+
subscribe(listener: IListener<T>): IOrderedSubscriptionLike<T>;
|
|
159
|
+
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { Observable, SubscribeObject } from "./Observable";
|
|
2
|
-
import { IListener,
|
|
2
|
+
import { ICallback, IListener, IOrdered, IOrderedSetup, IOrderedSubscribe, IOrderedSubscriptionLike } from "./Types";
|
|
3
3
|
export declare class OrderedSubscribeObject<T> extends SubscribeObject<T> {
|
|
4
|
+
constructor(observable: OrderedObservable<T> | IOrdered<T>, listener?: IListener<T>);
|
|
4
5
|
get order(): number;
|
|
5
6
|
set order(value: number);
|
|
6
7
|
subscribe(listener: IListener<T>): IOrderedSubscriptionLike<T>;
|
|
8
|
+
setOnce(): IOrderedSubscribe<T>;
|
|
9
|
+
unsubscribeByNegative(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
10
|
+
unsubscribeByPositive(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
11
|
+
emitByNegative(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
12
|
+
emitByPositive(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
13
|
+
emitMatch(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
7
14
|
}
|
|
8
|
-
export declare class OrderedObservable<T> extends Observable<T> implements
|
|
15
|
+
export declare class OrderedObservable<T> extends Observable<T> implements IOrdered<T> {
|
|
9
16
|
sortByOrder(): void;
|
|
10
17
|
subscribe(listener: IListener<T>): IOrderedSubscriptionLike<T>;
|
|
11
|
-
pipe():
|
|
18
|
+
pipe(): IOrderedSetup<T>;
|
|
12
19
|
}
|
|
@@ -19,8 +19,8 @@ exports.OrderedObservable = exports.OrderedSubscribeObject = void 0;
|
|
|
19
19
|
var Observable_1 = require("./Observable");
|
|
20
20
|
var OrderedSubscribeObject = /** @class */ (function (_super) {
|
|
21
21
|
__extends(OrderedSubscribeObject, _super);
|
|
22
|
-
function OrderedSubscribeObject() {
|
|
23
|
-
return _super
|
|
22
|
+
function OrderedSubscribeObject(observable, listener) {
|
|
23
|
+
return _super.call(this, observable, listener) || this;
|
|
24
24
|
}
|
|
25
25
|
Object.defineProperty(OrderedSubscribeObject.prototype, "order", {
|
|
26
26
|
get: function () {
|
|
@@ -42,6 +42,24 @@ var OrderedSubscribeObject = /** @class */ (function (_super) {
|
|
|
42
42
|
this.listener = listener;
|
|
43
43
|
return this;
|
|
44
44
|
};
|
|
45
|
+
OrderedSubscribeObject.prototype.setOnce = function () {
|
|
46
|
+
return _super.prototype.setOnce.call(this);
|
|
47
|
+
};
|
|
48
|
+
OrderedSubscribeObject.prototype.unsubscribeByNegative = function (condition) {
|
|
49
|
+
return _super.prototype.unsubscribeByNegative.call(this, condition);
|
|
50
|
+
};
|
|
51
|
+
OrderedSubscribeObject.prototype.unsubscribeByPositive = function (condition) {
|
|
52
|
+
return _super.prototype.unsubscribeByPositive.call(this, condition);
|
|
53
|
+
};
|
|
54
|
+
OrderedSubscribeObject.prototype.emitByNegative = function (condition) {
|
|
55
|
+
return _super.prototype.emitByNegative.call(this, condition);
|
|
56
|
+
};
|
|
57
|
+
OrderedSubscribeObject.prototype.emitByPositive = function (condition) {
|
|
58
|
+
return _super.prototype.emitByPositive.call(this, condition);
|
|
59
|
+
};
|
|
60
|
+
OrderedSubscribeObject.prototype.emitMatch = function (condition) {
|
|
61
|
+
return _super.prototype.emitMatch.call(this, condition);
|
|
62
|
+
};
|
|
45
63
|
return OrderedSubscribeObject;
|
|
46
64
|
}(Observable_1.SubscribeObject));
|
|
47
65
|
exports.OrderedSubscribeObject = OrderedSubscribeObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderedObservable.js","sourceRoot":"","sources":["../../Libraries/Observables/OrderedObservable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAyD;
|
|
1
|
+
{"version":3,"file":"OrderedObservable.js","sourceRoot":"","sources":["../../Libraries/Observables/OrderedObservable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAyD;AAYzD;IAA+C,0CAAkB;IAC7D,gCAAY,UAA8C,EAAE,QAAuB;eAC/E,kBAAoB,UAAU,EAAE,QAAQ,CAAC;IAC7C,CAAC;IAED,sBAAI,yCAAK;aAAT;YACI,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;aAED,UAAU,KAAa;YACnB,IAAI,CAAC,IAAI,CAAC,UAAU;gBAChB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBAClD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;gBACxB,OAAM;aACT;YACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACM,IAAI,CAAC,UAAW,CAAC,WAAW,EAAE,CAAC;QAC7D,CAAC;;;OAVA;IAYD,0CAAS,GAAT,UAAU,QAAsB;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,wCAAO,GAAP;QACI,OAAY,iBAAM,OAAO,WAAE,CAAC;IAChC,CAAC;IAED,sDAAqB,GAArB,UAAsB,SAAyB;QAC3C,OAAY,iBAAM,qBAAqB,YAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,sDAAqB,GAArB,UAAsB,SAAyB;QAC3C,OAAY,iBAAM,q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,eAAe,CAAC,CAAC;QACrC,OAAO,eAAe,CAAC;IAC3B,CAAC;IACL,wBAAC;AAAD,CAAC,AAxBD,CACY,uBAAU,GAuBrB;AAxBY,8CAAiB"}
|
|
@@ -17,6 +17,9 @@ export declare type IOrder = {
|
|
|
17
17
|
export declare type IOnce<T> = {
|
|
18
18
|
setOnce(): ISubscribe<T>;
|
|
19
19
|
};
|
|
20
|
+
export declare type IOrderedOnce<T> = {
|
|
21
|
+
setOnce(): IOrderedSubscribe<T>;
|
|
22
|
+
};
|
|
20
23
|
export declare type ISetObservableValue = {
|
|
21
24
|
next(value: any): void;
|
|
22
25
|
};
|
|
@@ -24,6 +27,7 @@ export declare type ISubscriptionLike<T> = {
|
|
|
24
27
|
unsubscribe(): void;
|
|
25
28
|
};
|
|
26
29
|
export declare type ISetup<T> = IUnsubscribeByNegative<T> & IUnsubscribeByPositive<T> & IEmitByNegative<T> & IEmitByPositive<T> & IEmitMatchCondition<T> & IOnce<T> & ISubscribe<T>;
|
|
30
|
+
export declare type IOrderedSetup<T> = IOrderedUnsubscribeByNegative<T> & IOrderedUnsubscribeByPositive<T> & IOrderedEmitByNegative<T> & IOrderedEmitByPositive<T> & IOrderedEmitMatchCondition<T> & IOrderedOnce<T> & IOrderedSubscribe<T>;
|
|
27
31
|
export declare type ISubscribeObject<T> = ISubscriptionLike<T> & IPause & IOrder & ISend<T> & ISetup<T>;
|
|
28
32
|
export declare type ISubscribeCounter = {
|
|
29
33
|
size(): number;
|
|
@@ -51,18 +55,33 @@ export declare type ISend<T> = {
|
|
|
51
55
|
export declare type IUnsubscribeByNegative<T> = {
|
|
52
56
|
unsubscribeByNegative(condition: ICallback<any>): ISubscribe<T>;
|
|
53
57
|
};
|
|
58
|
+
export declare type IOrderedUnsubscribeByNegative<T> = {
|
|
59
|
+
unsubscribeByNegative(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
60
|
+
};
|
|
54
61
|
export declare type IUnsubscribeByPositive<T> = {
|
|
55
62
|
unsubscribeByPositive(condition: ICallback<any>): ISubscribe<T>;
|
|
56
63
|
};
|
|
64
|
+
export declare type IOrderedUnsubscribeByPositive<T> = {
|
|
65
|
+
unsubscribeByPositive(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
66
|
+
};
|
|
57
67
|
export declare type IEmitByNegative<T> = {
|
|
58
68
|
emitByNegative(condition: ICallback<any>): ISubscribe<T>;
|
|
59
69
|
};
|
|
70
|
+
export declare type IOrderedEmitByNegative<T> = {
|
|
71
|
+
emitByNegative(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
72
|
+
};
|
|
60
73
|
export declare type IEmitByPositive<T> = {
|
|
61
74
|
emitByPositive(condition: ICallback<any>): ISubscribe<T>;
|
|
62
75
|
};
|
|
76
|
+
export declare type IOrderedEmitByPositive<T> = {
|
|
77
|
+
emitByPositive(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
78
|
+
};
|
|
63
79
|
export declare type IEmitMatchCondition<T> = {
|
|
64
80
|
emitMatch(condition: ICallback<any>): ISubscribe<T>;
|
|
65
81
|
};
|
|
82
|
+
export declare type IOrderedEmitMatchCondition<T> = {
|
|
83
|
+
emitMatch(condition: ICallback<any>): IOrderedSubscribe<T>;
|
|
84
|
+
};
|
|
66
85
|
export declare type ICollector = IDestroy & ISubscribeCounter & {
|
|
67
86
|
collect(...subscriptionLikeList: ISubscriptionLike<any>[]): void;
|
|
68
87
|
unsubscribe(subscriptionLike: ISubscriptionLike<any>): void;
|
|
@@ -71,4 +90,8 @@ export declare type ICollector = IDestroy & ISubscribeCounter & {
|
|
|
71
90
|
export declare type IOrderedObservable = {
|
|
72
91
|
sortByOrder(): void;
|
|
73
92
|
};
|
|
93
|
+
export declare type IOrdered<T> = IObserver<T> & IOrderedObservable;
|
|
74
94
|
export declare type IOrderedSubscriptionLike<T> = ISubscriptionLike<T> & IOrder;
|
|
95
|
+
export declare type IOrderedSubscribe<T> = {
|
|
96
|
+
subscribe(listener: IListener<T>): IOrderedSubscriptionLike<T>;
|
|
97
|
+
};
|